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

标签 python google-drive-api jupyter-notebook google-colaboratory

我正在使用本地运行时运行 Google Colab。我使用此命令启动 Jupyter:

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

当我之前连接时,我能够在笔记本中使用以下代码安装 Google Drive:

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

我能够在本地运行时连接到 Google 云端硬盘并访问文件。 但是,现在我收到此错误:

ModuleNotFoundError: No module named 'google.colab'

我看到其他人也有这个问题,有些人建议使用 PyDrive。但我确信我在没有使用 PyDrive 的情况下连接到了 Google Drive。

我怀疑当 Google Drive 能够连接时,我运行的启动 Jupyter 的第一个命令有所不同。 我是否必须添加到第一个命令中的特定标志

最佳答案

google.colab 库仅存在于托管后端上。

在本地计算机上运行时,您需要改用云端硬盘现有的同步应用程序:https://www.google.com/drive/download/

关于python - 如何使用 Google Colab 本地运行时并连接到 Google Drive,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60008929/

相关文章:

html - 带有Google V3 API的Golang : Passing alt=media to Export call

python - 在Conda环境中安装python内核

java - 如何在 Jupyter Notebook 内的 conda 环境中使用特定的 Java 版本

python - urllib.urlencode : TypeError not a valid non-string sequence or mapping object

python - Spark 枢转一列,但保持其他列完好无损

python - 为什么递归次数9小于递归限制?

java - "401 Unauthorized"尝试使用 Java API 客户端查看 Google Drive 上的更改

python - 如何有效地绘制大量线形,其中点两两相连?

push-notification - Python 接收 Google Drive 推送通知

python - 导入错误 : No module named xgboost