挂载
- 复制以下代码
!apt-get install -y -qq software-properties-common python-software-properties module-init-tools
!add-apt-repository -y ppa:alessandro-strada/ppa 2>&1 > /dev/null
!apt-get update -qq 2>&1 > /dev/null
!apt-get -y install -qq google-drive-ocamlfuse fuse
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}
- 点击链接,登录谷歌账号,获取验证码,复制。
Please enter the verification code: Access token retrieved correctly.
表示验证成功- 执行以下代码进行挂载
!mkdir -p drive
!google-drive-ocamlfuse -o nonempty drive
此时根目录为drive,可以通过!ls drive
命令查看根目录下文件列表
从GitHub上下载项目
从GitHub上下载project至colab
!git clone + 地址