我使用python 3.6.0。
我想玩Google Drive API。
当我import oauth2client.service_account
时出现此错误:
Traceback (most recent call last):
File "test.py", line 3, in <module>
from oauth2client.service_account import _ServiceAccountCredentials
File "C:\Users\aaron\Anaconda3\lib\site-packages\oauth2client\service_account.py", line 26, in <module>
from oauth2client import crypt
File "C:\Users\aaron\Anaconda3\lib\site-packages\oauth2client\crypt.py", line 23, in <module>
from oauth2client import _pure_python_crypt
File "C:\Users\aaron\Anaconda3\lib\site-packages\oauth2client\_pure_python_crypt.py", line 24, in <module>
from pyasn1_modules.rfc2459 import Certificate
File "C:\Users\aaron\Anaconda3\lib\site-packages\pyasn1_modules\rfc2459.py", line 20, in <module>
from pyasn1.type import opentype
ImportError: cannot import name 'opentype'
答案 0 :(得分:0)
考虑升级您的google-auth模块
pip install --upgrade google-auth-oauthlib
,还有pyasn1_module,它负责将ASN.1类型和编解码器实现为Python包
pip install --upgrade pyasn1-modules
更新 工作解决方案: 强制安装模块
pip install -U -I pyasn1 pyasn1-modules