简体   繁体   English

如何使用 Google Colab 本地运行时并连接到 Google Drive

[英]How to use Google Colab local runtime and connect to Google Drive

I am running Google Colab with a local runtime.我正在使用本地运行时运行 Google Colab。 I use this command to start Jupyter:我使用这个命令来启动 Jupyter:

jupyter notebook  --NotebookApp.allow_origin='https://colab.research.google.com' --port=8888  --NotebookApp.port_retries=0

When I previously connected I was able to mount Google Drive with this code in the notebook:当我之前连接时,我能够在笔记本中使用此代码安装 Google Drive:

from google.colab import drive
drive.mount('/content/drive')

I was able to connect to Google Drive and access files while on local runtime.我能够在本地运行时连接到 Google Drive 并访问文件。 However, now I am getting this error:但是,现在我收到此错误:

ModuleNotFoundError: No module named 'google.colab'

I see other people have this problem, and some suggest using PyDrive.我看到其他人有这个问题,有些人建议使用 PyDrive。 But I am certain I was connected to Google Drive without using PyDrive.但我确信我在没有使用 PyDrive 的情况下连接到了 Google Drive。

I suspect the first command I ran to start Jupyter was different when Google Drive was able to connect.我怀疑当 Google Drive 能够连接时,我运行的第一个命令启动 Jupyter 是不同的。 Is there a specific flag I have to add to that first command有没有我必须添加到第一个命令的特定标志

The google.colab libraries only exist on managed backends. google.colab库仅存在于托管后端。

When running on your local machine, you'll want to instead use Drive's existing sync apps available here: https://www.google.com/drive/download/在本地计算机上运行时,您需要改用 Drive 现有的同步应用程序,此处提供: https : //www.google.com/drive/download/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM