AuthorizationError: Failed to fetch user credentials in google Colab
AuthorizationError: Failed to fetch user credentials in google Colab
我有一个存储在共享 google 驱动器中的 colab 笔记本。想法是与其他 gsuite 用户共享此笔记本。当他们将其复制粘贴到本地驱动器时,他们中的一些人可以 运行 它并对其进行处理,而另一些人则打印出上述错误。
报错的代码如下:
!pip install -U -q PyDrive
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
from google.colab import auth
from oauth2client.client import GoogleCredentials
# Authenticate and create the PyDrive client.
auth.authenticate_user()
gauth = GoogleAuth()
gauth.credentials = GoogleCredentials.get_application_default()
drive = GoogleDrive(gauth)
这部分代码打印出以下错误:
AuthorizationError Traceback (most recent call last)
<ipython-input-9-6beb6b456bb8> in <module>()
5 from oauth2client.client import GoogleCredentials
6 # Authenticate and create the PyDrive client.
----> 7 auth.authenticate_user()
8 gauth = GoogleAuth()
9 gauth.credentials = GoogleCredentials.get_application_default()
/usr/local/lib/python3.6/dist-packages/google/colab/auth.py in authenticate_user(clear_output)
160 if _check_adc():
161 return
--> 162 raise _errors.AuthorizationError('Failed to fetch user credentials')
AuthorizationError: Failed to fetch user credentials
总的来说,我是 colab 和 gsuite 的新手,我不确定如何进行。欢迎任何帮助
显然这个问题与上一步有关。
执行后
!pip install -U tensorflow-gpu==2.0.0 grpcio
需要重新启动运行时,即:
我不是 100% 确定这是什么原因,但它解决了问题。
希望对您有所帮助!
我有一个存储在共享 google 驱动器中的 colab 笔记本。想法是与其他 gsuite 用户共享此笔记本。当他们将其复制粘贴到本地驱动器时,他们中的一些人可以 运行 它并对其进行处理,而另一些人则打印出上述错误。
报错的代码如下:
!pip install -U -q PyDrive
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
from google.colab import auth
from oauth2client.client import GoogleCredentials
# Authenticate and create the PyDrive client.
auth.authenticate_user()
gauth = GoogleAuth()
gauth.credentials = GoogleCredentials.get_application_default()
drive = GoogleDrive(gauth)
这部分代码打印出以下错误:
AuthorizationError Traceback (most recent call last)
<ipython-input-9-6beb6b456bb8> in <module>()
5 from oauth2client.client import GoogleCredentials
6 # Authenticate and create the PyDrive client.
----> 7 auth.authenticate_user()
8 gauth = GoogleAuth()
9 gauth.credentials = GoogleCredentials.get_application_default()
/usr/local/lib/python3.6/dist-packages/google/colab/auth.py in authenticate_user(clear_output)
160 if _check_adc():
161 return
--> 162 raise _errors.AuthorizationError('Failed to fetch user credentials')
AuthorizationError: Failed to fetch user credentials
总的来说,我是 colab 和 gsuite 的新手,我不确定如何进行。欢迎任何帮助
显然这个问题与上一步有关。 执行后
!pip install -U tensorflow-gpu==2.0.0 grpcio
需要重新启动运行时,即:
我不是 100% 确定这是什么原因,但它解决了问题。 希望对您有所帮助!