from oauth2client.service_account import ServiceAccountCredentials : cannot import name 'opentype' [duplicate]

こ雲淡風輕ζ 提交于 2020-01-25 06:05:09

问题


I use python 3.6.0. I want to play with the Google Drive API. When I import oauth2client.service_account I get this error :

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'

回答1:


Consider upgrading your google-auth module

pip install --upgrade google-auth-oauthlib

and also the pyasn1_module, which is reponsible for implementation of ASN.1 types and codecs as a Python package

pip install --upgrade pyasn1-modules

UPDATE Working solution: Force install your modules

pip install -U -I pyasn1 pyasn1-modules


来源:https://stackoverflow.com/questions/52163971/from-oauth2client-service-account-import-serviceaccountcredentials-cannot-impo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!