2015-06-12 71 views
0

我是GAE的新手。我正在使用eclipse + Pydev。我收到此錯誤from google.appengine.ext.webapp.util import run_wsgi_app ImportError:沒有名爲google.appengine.ext.webapp.util的模塊

from google.appengine.ext.webapp.util import run_wsgi_app 
    ImportError: No module named google.appengine.ext.webapp.util 

這裏是我進口

import cgi 
import webapp2 
from google.appengine.ext.webapp.util import run_wsgi_app 
import MySQLdb 
import os 
import jinja2 
我使用Ubuntu

。我在stackoverflow中搜索了這個錯誤,但沒有找到任何令人信服的答案。

我甚至已經下載了appengine,並重新安裝了一次又一次,但那是沒用的。

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

請爲我提供類似鏈接等 一個正確的答案與你這個鏈接等上不回覆可以找到有關這個..我已經尋找在網上許多鏈接,但是我做不到找到對問題有說服力的解釋。

回答

1

您需要確保您下載的App Engine SDK位於您的Python路徑中。您可以檢查通過交互運行蟒蟒什麼認爲它的路徑:

$ python 
>>> import sys 
>>> sys.path 
['', '/Library/Python/2.7/site-packages/mock-1.0.1-py2.7.egg', '/usr/local/lib/wxPython-2.9.5.0/lib/python2.7/site-packages', '/usr/local/lib/wxPython-2.9.5.0/lib/python2.7/site-packages/wx-2.9.5-osx_cocoa', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC', '/Library/Python/2.7/site-packages', '/usr/local/lib/wxPython-2.9.5.0/lib/python2.7'] 

或者你可以在運行時SDK添加到Python路徑。例如,如果您已下載並解壓縮到/ home/username/google_appengine,則可以在腳本中修改您的Python路徑:

sys.path.append('/home/username/google_appengine') 
import dev_appserver 
dev_appserver.fix_sys_path() 

from google.appengine.ext.webapp.util import run_wsgi_app 
相關問題