Colab - 与谷歌驱动器连接的自动身份验证,每个笔记本的持久性 [英] Colab - automatic authentication of connection to google drive, persistent per-notebook
问题描述
我正在寻找一种在将 colab 会话连接到我的谷歌驱动器时自动执行身份验证过程的方法.
I'm looking for a way to automate the authentication process when connecting a colab-session to my google drive.
我更喜欢使用内置工具,而不是 PyDrive.
I'd prefer to use the built-in tools for this one, instead of PyDrive.
简而言之:无需通过登录并从对话框中复制密码来手动验证,即可运行以下单元格
In short: have the following cell run without having to manually authenticate by logging in and copying the password from the dialogue
from google.colab import drive
drive.mount('/content/drive/')
推荐答案
Colab 笔记本现在支持自动挂载到您的云端硬盘文件,但不能由多人共享.
Automatically mounting to your Drive files is now supported for Colab notebooks which aren't shared by multiple people.
要为笔记本启用此功能,请创建一个新的 Drive 笔记本,打开文件浏览器,然后单击Mount Drive"按钮.
To enable this for a notebook, create a new Drive notebook, open the file browser, and click the 'Mount Drive' button.
您将看到如下所示的权限对话框:
You'll see a permissions dialog like so:
完成一次权限后,您将在文件浏览器中看到您的云端硬盘.
After you complete the permissions once, you'll see your Drive mounted in the file browser.
更好的是,如果您稍后重新加载笔记本并重新连接,您的驱动器将自动挂载,不再需要 drive.mount
复制/粘贴.您的云端硬盘文件就在那里.
Better still, if you reload the notebook later and reconnect, your Drive will mount automatically with no more drive.mount
copy/paste required. Your Drive files will just be there.
这篇关于Colab - 与谷歌驱动器连接的自动身份验证,每个笔记本的持久性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!