我有兴趣尝试使用Google colab进行GPU深度学习,并且在以下教程博客中关注如何使用Google驱动器设置深度学习环境: https://medium.com/deep-learning-turkey/google-colab-free-gpu-tutorial-e113627b9f5d
我已经设置了Google驱动器和适当的文件夹目录,并且在博客“ 使用Google Colab运行或导入.py文件”中, 首先运行这些代码以安装必要的库并执行授权 ”,然后我应该在Google Ipython编辑器中运行以下代码:
!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}
代码也按照其预期的方式执行,然后出现超链接和框,我可以在其中复制和粘贴授权密钥。当我粘贴密钥时,什么也不会发生。如果Python忙,该图标将永远旋转(忙)……按下Enter键似乎会删除授权密钥,我也不认为这是合适的。
使用!kill -9 -1
重新启动虚拟机似乎没有任何作用,然后重新运行代码……任何提示都可以帮助谢谢!!!
答案 0 :(得分:0)
输入密码后按Enter键就足够了。您遇到什么问题? (输入代码后,您将需要执行其他代码来访问云端硬盘,如链接文章中所述。)
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright (C) 2013-2018 Diego Torres Milano
Created on 2018-08-09 by Culebra v15.4.0
__ __ __ __
/ \ / \ / \ / \
____________________/ __\/ __\/ __\/ __\_____________________________
___________________/ /__/ /__/ /__/ /________________________________
| / \ / \ / \ / \ \___
|/ \_/ \_/ \_/ \ o \
\_____/--<
@author: Diego Torres Milano
@author: Jennifer E. Swofford (ascii art snake)
"""
import re
import sys
import os
import unittest
from com.dtmilano.android.viewclient import ViewClient, CulebraTestCase
TAG = 'CULEBRA'
class CulebraTests(CulebraTestCase):
@classmethod
def setUpClass(cls):
cls.kwargs1 = {'ignoreversioncheck': False, 'verbose': False, 'ignoresecuredevice': False}
cls.kwargs2 = {'forceviewserveruse': False, 'useuiautomatorhelper': False, 'ignoreuiautomatorkilled': True, 'autodump': False, 'debug': {}, 'startviewserver': True, 'compresseddump': True}
cls.options = {'start-activity': None, 'concertina': False, 'device-art': None, 'use-jar': False, 'multi-device': False, 'unit-test-class': True, 'save-screenshot': None, 'use-dictionary': False, 'glare': False, 'dictionary-keys-from': 'id', 'scale': 0.5, 'find-views-with-content-description': True, 'window': -1, 'orientation-locked': None, 'concertina-config': None, 'save-view-screenshots': None, 'find-views-by-id': True, 'log-actions': False, 'use-regexps': False, 'null-back-end': False, 'auto-regexps': None, 'do-not-verify-screen-dump': True, 'verbose-comments': False, 'gui': True, 'find-views-with-text': True, 'prepend-to-sys-path': False, 'install-apk': None, 'drop-shadow': False, 'output': 'aonoff.py', 'unit-test-method': None, 'interactive': False}
cls.sleep = 5
def setUp(self):
super(CulebraTests, self).setUp()
def tearDown(self):
super(CulebraTests, self).tearDown()
def preconditions(self):
if not super(CulebraTests, self).preconditions():
return False
return True
def testSomething(self):
if not self.preconditions():
self.fail('Preconditions failed')
_s = CulebraTests.sleep
_v = CulebraTests.verbose
self.vc.dump(window=-1)
self.vc.uiDevice.openQuickSettings()
self.vc.sleep(_s)
self.vc.dump(window=-1)
self.vc.findViewWithContentDescriptionOrRaise(u'''Airplane mode''').touch()
self.vc.sleep(_s)
self.vc.dump(window=-1)
self.device.press('KEYCODE_BACK')
self.device.press('KEYCODE_BACK')
print >> sys.stderr, 'Now Airplane mode is ON, switching it back to OFF'
self.vc.sleep(5)
self.vc.uiDevice.openQuickSettings()
self.vc.sleep(_s)
self.vc.dump(window=-1)
self.vc.findViewWithContentDescriptionOrRaise(u'''Airplane mode''').touch()
self.vc.sleep(_s)
self.vc.dump(window=-1)
self.device.press('KEYCODE_BACK')
self.device.press('KEYCODE_BACK')
if __name__ == '__main__':
CulebraTests.main()