问题描述
我正在寻找一种将colab会话连接到我的Google驱动器时自动进行身份验证过程的方法.
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-自动验证与Google Drive的连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!