我创建了一个新的 Colaboratory notebook,并希望对自己进行身份验证以访问我的云端硬盘上的文件。但是当我在下面运行脚本时
from google.colab import auth
auth.authenticate_user()
from oauth2client.client import GoogleCredentials
creds = GoogleCredentials.get_application_default()
import getpass
!google-drive-ocamlfuse --headless -id={creds.client_id} -secret={creds.client_secret} < /dev/null 2>&1 | grep URL
vcode = getpass.getpass()
!echo {vcode} | google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret}
我唯一能看到的是文本输入,没有任何链接,什么都没有。
当我输入任何内容时,我都会收到 /bin/sh: 1: google-drive-ocamlfuse: not found
。我最近经常遇到这种情况,我做错了什么?
最佳答案
编辑:自最初回答这个问题以来,谷歌已经添加了内置的 Drive FUSE 支持。您可以使用更紧凑的代码段装载您的云端硬盘文件:
from google.colab import drive
drive.mount('/content/gdrive')
此处提供了使用此实用程序安装和装载 Drive 文件的完整示例:
https://colab.research.google.com/drive/1srw_HFWQ2SMgmWIawucXfusGzrj1_U0q
关于python - Google Colaboratory 在授权期间不显示链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50270540/