google.appengine.ext Python Module ImportError No module named google.appengine.ext

冷暖自知 提交于 2019-12-22 05:33:28

问题


Python 2.7.6, Google APIs Client Library for Python for Google App Engine, Google Developer's Guide

I'm going through the Google documentation, and trying to duplicate their example. When I run the command:

from google.appengine.ext import webapp

from Python Shell, I get the error msg:

No module named google.appengine.ext

So obviously, that file is not on my computer. I've done searches for the file on my hard drive and haven't found anything. I've run easy_install to install the Google API as instructed in the official Google Quick Start video. I'm not sure if Google's documentation is now outdated, or what is happening. Where do I get the google.appengine.ext? I'm assuming that my problem is simply that I don't have that module.


回答1:


You may need to add the following line, incase you are running stand alone tests

 sys.path.append('/usr/local/google_appengine/')
 sys.path.append('/usr/local/google_appengine/lib/yaml/lib/')
 if 'google' in sys.modules:
     del sys.modules['google']



回答2:


I've seen @varun answer in other question, and he use insert instead of append, and then this work perfectly, at least for me.

sys.path.insert(1, '<yourFolder>/google_appengine')
sys.path.insert(1, '<yourFolder>/google_appengine/lib/yaml/lib')
if 'google' in sys.modules:           
    del sys.modules['google']



回答3:


App Engine samples presume that you have the App Engine SDK installed:

https://developers.google.com/appengine/downloads

https://developers.google.com/api-client-library/python/start/installation#appengine




回答4:


The google.appengine.ext means google/appengine/ext it is just like the packages directory in Eclipse



来源:https://stackoverflow.com/questions/20878885/google-appengine-ext-python-module-importerror-no-module-named-google-appengine

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