{"id":1806,"date":"2019-06-05T07:09:30","date_gmt":"2019-06-04T23:09:30","guid":{"rendered":"http:\/\/www.ouvps.com\/?p=1806"},"modified":"2019-06-05T07:10:18","modified_gmt":"2019-06-04T23:10:18","slug":"colaboratory-%e8%bf%9e%e6%8e%a5google-drive","status":"publish","type":"post","link":"https:\/\/eepu.top\/?p=1806","title":{"rendered":"Colaboratory \u8fde\u63a5Google Drive"},"content":{"rendered":"<p>\u65b9\u6cd5\u4e00<\/p>\n<pre lang='shell'>\r\n!echo 'Mounting...'\r\nfrom google.colab import drive\r\ndrive.mount('\/content\/drive\/')\r\n!ls '\/content\/drive\/My Drive'\r\n!echo 'Mounted'\r\n\r\n<\/pre>\n<p>\u65b9\u6cd5\u4e8c\uff1a<\/p>\n<pre lang='shell'>\r\n!echo 'Installing required software'\r\n!apt-get install -y -qq software-properties-common module-init-tools 2>&1 > \/dev\/null\r\n!echo 'Add apt-repository with Google.Drive Fuse'\r\n!add-apt-repository -y ppa:alessandro-strada\/ppa 2>&1 > \/dev\/null\r\n!echo 'Updating packages...'\r\n!apt-get update -y -qq\r\n!echo 'Installing google-drive-ocamlfuse fuse...'\r\n!apt-get install -y -qq google-drive-ocamlfuse fuse\r\n!echo 'Authenticate Fuse in Google.Drive...'\r\nfrom google.colab import auth\r\nfrom oauth2client.client import GoogleCredentials\r\nimport getpass\r\nauth.authenticate_user()\r\ncreds = GoogleCredentials.get_application_default()\r\n!google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret} < \/dev\/null 2>&1 | grep URL\r\nvcode = getpass.getpass('Enter auth code here: ')\r\n!echo {vcode} | google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret}\r\n!echo 'Authenticated!'\r\n!echo 'Creating mount directory'\r\n!mkdir .\/drive2\r\n!echo 'Mounting...'\r\n!google-drive-ocamlfuse .\/drive2\r\n!ls .\/drive2\r\n!echo 'Mounted!'\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u65b9\u6cd5\u4e00 !echo &#8216;Mounting&#8230;&#8217; from google.colab import drive  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[],"_links":{"self":[{"href":"https:\/\/eepu.top\/index.php?rest_route=\/wp\/v2\/posts\/1806"}],"collection":[{"href":"https:\/\/eepu.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/eepu.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/eepu.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/eepu.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1806"}],"version-history":[{"count":2,"href":"https:\/\/eepu.top\/index.php?rest_route=\/wp\/v2\/posts\/1806\/revisions"}],"predecessor-version":[{"id":1808,"href":"https:\/\/eepu.top\/index.php?rest_route=\/wp\/v2\/posts\/1806\/revisions\/1808"}],"wp:attachment":[{"href":"https:\/\/eepu.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1806"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/eepu.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1806"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/eepu.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1806"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}