ImportError: No module named httplib2

99封情书 提交于 2019-12-22 04:35:38

问题


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

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