Google Drive API - ImportError: cannot import name util

依然范特西╮ 提交于 2019-12-06 03:51:00

问题


I'm trying to follow this tutorial: https://developers.google.com/drive/v3/web/quickstart/python#step_1_turn_on_the_api_name

However when I run it I get the following error:

Traceback (most recent call last):
  File "test.py", line 5, in <module>
    from apiclient import discovery
  File "/Library/Python/2.7/site-packages/apiclient/__init__.py", line 16, in <module>
    from googleapiclient import channel
  File "/Library/Python/2.7/site-packages/googleapiclient/channel.py", line 62, in <module>
    from googleapiclient import errors
  File "/Library/Python/2.7/site-packages/googleapiclient/errors.py", line 25, in <module>
    from oauth2client import util
ImportError: cannot import name util

I've tried using version 1.3.2 of the Google API which I read may fix the issue but it didn't seem to change anything.

I'm fairly new to Python.


回答1:


My first guess is that your version of oauth2client is incompatible with your version of google-api-python-client.

Try to use google-api-python-client==1.5.2 together with oauth2client==2.2.0, for example



来源:https://stackoverflow.com/questions/40708563/google-drive-api-importerror-cannot-import-name-util

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