问题
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