授权错误:无法在google Colab中获取用户凭据

2024-06-16 11:30:31 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个colab笔记本存储在共享的google驱动器中。我们的想法是与其他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)

这部分代码将打印以下错误:

^{pr2}$

一般来说,我对colab和gsuite还不太熟悉,我不知道该怎么做。欢迎任何帮助


Tags: 代码fromimportauth错误google笔记本drive
1条回答
网友
1楼 · 发布于 2024-06-16 11:30:31

显然这个问题与前一步有关。 执行后

!pip install -U tensorflow-gpu==2.0.0 grpcio

必须重新启动运行时,即:

enter image description here

我不能百分之百肯定这是为什么,但它解决了问题。 我希望这有帮助!在

相关问题 更多 >