码迷,mamicode.com
首页 > 其他好文 > 详细

Google Colab Notebook 的外部文件引用配置

时间:2018-10-30 21:21:17      阅读:535      评论:0      收藏:0      [点我收藏+]

标签:too   ola   mon   配置   drive   repo   rom   pass   pre   

Google Colab Notebook 的外部文件引用配置

Reference: How to upload the file and read Google Colab

  1. 先装工具:google-drive-ocamlfuse

    !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}
    
    
  2. 去网页确认一下:

    confirm the authentication of this access. Follow the order saying open the link, and you will visit some blue-ish page displaying your key. *

  3. 再挂载
    !mkdir drive !google-drive-ocamlfuse drive !ls drive/"Colab Notebooks"
    就可以了。

Google Colab Notebook 的外部文件引用配置

标签:too   ola   mon   配置   drive   repo   rom   pass   pre   

原文地址:https://www.cnblogs.com/sonictl/p/9879177.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!