问题
I have python webapp2 application but when I run it I get this error
ImportError: No module named googleapiclient.discovery
what I found in stackoverflow is ImportError: No module named apiclient.discovery
I tried to do what people said but it did not work
EDIT:
pip freeze
回答1:
This is resolved in another thread: ImportError: No module named apiclient.discovery
Also this one worked in our case
pip install --upgrade google-api-python-client
Using python 3.6.5
回答2:
I had the same issue. I am using the requirements.txt to install the libraries. My requirements.txt had google-api-python-client==1.6.2 and pip install was not installing the lib. I got rid of the version and have only google-api-python-client in the requirements.txt. After that i ran the pip install again and appengine app worked after that.
回答3:
Struggled with this issue for quite a while, trying to deploy on Heroku ( App worked locally). For me, the requirements.txt file had both google-api-python-client==1.6.2 and oauth2client==4.0.0 . I seemed to have resolved it by basically deleting the app and redeploying after removing the version data of google-api-python-client, and deleting oauth2client==4.0.0. Alternatively, you could try manually uninstalling google-api-python-client and all dependencies, and reinstalling them.
回答4:
Google App Engine + Flask App Deployment
My App works fine when locally. But I got this error when I was deploying the Flask app on Google App Engine. The reason was that I did not add google-api-python-client in requirement.txt
AFAIK Google app engine downloads all the dependency you pip installed. In order to run the python app, the App engine must know what libraries are needed to run your app.
So add all libraries in requirement.txt file.
Here is what my requirement.txt looks like
Flask==1.1.2
gunicorn==19.3.0
google-api-core==1.21.0
google-api-python-client==1.10.0
来源:https://stackoverflow.com/questions/43010073/importerror-no-module-named-googleapiclient-discovery