從昨天開始,我遇到了無法再掛載 Google 帳戶的問題。通常,當我運行它時,我會得到一個鏈接來授權自己。現在,當執行代碼時,會打開一個額外的瀏覽器視窗,我應該在其中授權自己。但如果我這樣做了,它就不起作用了。您知道為什么會突然不再顯示此授權鏈接嗎?可能有任何安全設定嗎?我試過幾個瀏覽器。
編輯:使用新的授權彈出視窗,如果我從同一個谷歌帳戶(如 colab)安裝谷歌驅動器,它就可以作業。但問題是我的主要谷歌驅動器在另一個帳戶上而不是谷歌 Colab。使用鏈接,它以前可以正常作業而沒有任何問題......
編輯 2:我現在已經解決了這個問題,我已經為我的其他帳戶共享了所需的檔案夾,現在可以通過我的 Colab Google Drive 帳戶訪問它。但是我還是沒能把鏈接找回來。
在使用新彈出視窗執行代碼和授權后,我在 Google Colab 上收到此錯誤訊息:
MessageError Traceback (most recent call last) in () 1 #Connect Google Drive 2 from google.colab import drive ----> 3 drive.mount('/gdrive')
3 幀 /usr/local/lib/python3.7/dist-packages/google/colab/_message.py in read_reply_from_input(message_id, timeout_sec) 104 reply.get('colab_msg_id') == message_id): 105 if 'error'回復:--> 106 raise MessageError(reply['error']) 107 return reply.get('data', None) 108
訊息錯誤:錯誤:憑據傳播失敗
我使用這個代碼:
#Connect Google Drive
from google.colab import drive
drive.mount('/gdrive')
授權彈出而不是代碼輸出中的鏈接
uj5u.com熱心網友回復:
我今天遇到了這個問題。我認為這對我們來說可以是一個臨時解決方案:
!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}
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/354200.html
