谷歌GPU服务器关联谷歌硬盘

1、打开谷歌云端硬盘网址:https://colab.research.google.com

2、新建一个python记事本后,输入下面代码:

!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}

3、网页会跳出一个连接,让你点击登录,并把相关的代码复制粘贴进输入框,重复一次后,就设置成功了。

4、之后输入以下代码并运行就可以了。

!mkdir -p drive
!google-drive-ocamlfuse drive

猜你喜欢

转载自blog.csdn.net/weixin_42007359/article/details/82384438