当前位置:网站首页>Geogle Colab笔记1--运行Geogle云端硬盘上的.py文件
Geogle Colab笔记1--运行Geogle云端硬盘上的.py文件
2022-07-25 15:28:00 【whut_L】
目录
一--Geogle Colab获得google drive的授权
二--指定Google Drive云端硬盘的根目录,名为drive
一--Geogle Colab获得google drive的授权
操作:新建一个Colab ipynb文件,输入以下代码:
!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}结果:弹出一个链接,点解链接获得Code,并输入至白框内,重复操作两次。



二--指定Google Drive云端硬盘的根目录,名为drive
!mkdir -p drive
!google-drive-ocamlfuse drive # 此时colab中出现drive的文件夹,里面就是你的google drive的根目录文件三--复制需运行.py文件所在文件夹的绝对路径

分析:上图中,本人将运行的.py文件是ntu_gendata.py(程序摘自CVPR 2020一篇Oral文章),则复制生成的路径为/content/drive/Shift-GCN-master/data_gen(注:不是ntu_gendata.py的路径,而是它所在文件夹即data_gen的路径),根据复制的路径执行以下代码:
cd /content/drive/Shift-GCN-master/data_gen四--运行需执行的.py文件
在Colab新代码框内执行以下代码:
!python ntu_gendata.py注:!为英文字母。
分析:代码运行后生成的文件,将自动保存在Geogle云端硬盘中(根据.py文件设定的路径)。
五--参考
边栏推荐
- PAT甲级1153 Decode Registration Card of PAT (25 分)
- window系统黑窗口redis报错20Creating Server TCP listening socket *:6379: listen: Unknown error19-07-28
- Vscode plugin collection
- Spark judges that DF is empty
- C # fine sorting knowledge points 10 generic (recommended Collection)
- Seata中jdbc下只有一个lib嘛?
- Understanding the execution order of T-SQL query from the execution order of join on and where
- How to solve the login problem after the 30 day experience period of visual stuido2019
- Spark SQL null value, Nan judgment and processing
- GAMES101复习:三维变换
猜你喜欢

ML - natural language processing - Introduction to natural language processing

Idea remotely submits spark tasks to the yarn cluster

ML - 语音 - 传统语音模型

ML - Speech - advanced speech model

异步fifo的实现

Run redis on docker to start in the form of configuration file, and the connection client reports an error: server closed the connection

Example of password strength verification

Understanding the execution order of T-SQL query from the execution order of join on and where

ML - 语音 - 深度神经网络模型

获取键盘按下的键位对应ask码
随机推荐
Spark SQL UDF function
2021江苏省赛A. Array-线段树,维护值域,欧拉降幂
GAMES101复习:三维变换
Instance tunnel use
2019浙江省赛C-错排问题,贪心
Understanding the execution order of T-SQL query from the execution order of join on and where
C language function review (pass value and address [binary search], recursion [factorial, Hanoi Tower, etc.))
苹果内购和Apple Pay 的区别
The development summary of the function of fast playback of audio and video in any format on the web page.
2021上海市赛-H-二分答案
JVM知识脑图分享
UIDocumentInteractionController UIDocumentPickerViewController
See a lot of blinking pictures on apps, especially the member page
Find out what happened in the process of new
Submarine cable detector tss350 (I)
NPM's nexus private server e401 E500 error handling record
Spark SQL common time functions
redis淘汰策列
Yan required executor memory is above the max threshold (8192mb) of this cluster!
MATLAB读取显示图像时数据格式转换原因