You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

更新Google库后无法导入external_account_authorized_user的问题求助

修复方案

错误原因

更新Google相关库后,google-auth-oauthlib的新版本依赖google-auth中的external_account_authorized_user模块,但你当前的google-auth版本过旧,不包含该模块,导致导入失败。

修复步骤

  • 卸载冲突的旧版本库
    pip uninstall -y google-auth google-auth-oauthlib
    
  • 重新安装兼容的最新稳定版
    pip install --upgrade google-auth google-auth-oauthlib google-api-python-client
    
    若需要固定版本以避免后续更新问题,可指定兼容版本:
    pip install google-auth>=2.15.0 google-auth-oauthlib>=1.0.0 google-api-python-client>=2.84.0
    

额外注意事项

你的代码中SCOPES设置为['https://www.googleapis.com/auth']是不规范的,应该使用日历API对应的具体权限,比如:

# 全权限(可修改日历)
SCOPES = ['https://www.googleapis.com/auth/calendar']
# 只读权限
SCOPES = ['https://www.googleapis.com/auth/calendar.readonly']

使用具体权限能避免不必要的权限申请,也符合Google API的使用规范。

内容的提问来源于stack exchange,提问作者Subhankar Chakraborty

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.15 08:10:31