尝试将一些pickle文件从Colab输出到google团队(共享)驱动器。请注意,团队驱动由其他人拥有
我知道如何输出文件到我的谷歌驱动器从Colab,一个问题是经常被问到的论坛。但是,我还没有看到任何关于如何输出到团队驱动的相关问题/答案
以下代码用于将文件输出到驱动器(我的):
import pickle
from google.colab import files
a_file = a_fun(a)
# save pickle in VM temporary
with open('a_file.pickle', 'wb') as handle:
pickle.dump(a_file, handle, protocol=pickle.HIGHEST_PROTOCOL)
!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}
!mkdir -p my_Drive
!google-drive-ocamlfuse my_Drive
!cp /content/a_file.pickle /content/Drive
print('output file success')
有没有一种方法可以做一个类似的技巧,以团队驱动
我怀疑授权有问题。因为在将文件输出到我自己的驱动器的情况下,它需要授权代码来访问我的驱动器
目前没有回答
相关问题 更多 >
编程相关推荐