Sub*_*rty 13 google-oauth google-api-python-client
from pprint import pprint
from Goo_gle import Create_Service
CLIENT_SECRET_FILE = 'Client_Calendar.json'
API_NAME = 'calendar'
API_VERSION = 'v3'
SCOPES = ['https://www.googleapis.com/auth']
service = Create_Service(CLIENT_SECRET_FILE, API_NAME, API_VERSION, SCOPES)
Run Code Online (Sandbox Code Playgroud)
输出:
Traceback (most recent call last): File "d:\Play with code\PROGRAMMINGS\Python\Artificial Inteligence\calen_dar.py", line 2, in <module>
from Goo_gle import Create_Service File "d:\Play with code\PROGRAMMINGS\Python\Artificial Inteligence\Goo_gle.py", line 5, in <module>
from google_auth_oauthlib.flow import Flow, InstalledAppFlow File "C:\Python\lib\site-packages\google_auth_oauthlib\__init__.py", line 21, in <module>
from .interactive import get_user_credentials File "C:\Python\lib\site-packages\google_auth_oauthlib\interactive.py", line 27, in <module>
import google_auth_oauthlib.flow File "C:\Python\lib\site-packages\google_auth_oauthlib\flow.py", line 69, in <module>
import google_auth_oauthlib.helpers File "C:\Python\lib\site-packages\google_auth_oauthlib\helpers.py", line 27, in <module>
from google.auth import external_account_authorized_user ImportError: cannot import name 'external_account_authorized_user' from 'google.auth' (C:\Python\lib\site-packages\google\auth\__init__.py)
Run Code Online (Sandbox Code Playgroud)
我不明白为什么会发生这种情况。这段代码在过去 3 个月一直有效,但是今天更新 google 库后,出现了这个错误。如何解决这个问题?
小智 8
google_auth_oauthlib当使用最新版本(0.6.0)时,您会收到该错误。请参阅此链接:https://github.com/googleapis/google-auth-library-python-oauthlib/blob/v0.6.0/google_auth_oauthlib/helpers.py#L27
尝试使用以下命令降级 google-auth-oauthlib lib:
pip install google-auth-oauthlib==0.4.6
或更新您的requirement.txt以添加此行:
...
google-auth-oauthlib==0.4.6
...
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10482 次 |
| 最近记录: |