问题
I have a Python 2.7 GAE app that already has a lot of functionality. Now I want to integrate with a Google API.
Within my IDE (PyCharm) running on Mac OSX, I added the following lines to my app's main program:
import httplib2
pass
When I COMMAND-click "httplib2", the IDE opens "httplib2-0.8-py2.7.egg/httplib2/init.py" in an editor panel, so the IDE apparently knows where httplib2 is. But running the app, I get the error shown in the title.
To test further, I put breakpoints on both statements shown above and then run the app in debug mode. When it gets to the import statement, I immediately click the "Resume Program" icon.
The console then shows:
ImportError: No module named httplib2
The program then loops. That is, it doesn't terminate, but it never reaches the "pass" statement.
So the IDE seems to know where "httplib2" is, but Python doesn't seem to. Any help on how to get "import httplib2" to succeed will be appreciated. Thanks.
回答1:
httplib2
is not a standard library that comes with Python, but rather an externally-developed, optional package. If you want it to be available on Google App Engine, you'll have to include it in your application.
来源:https://stackoverflow.com/questions/15455861/importerror-no-module-named-httplib2