我今天尝试运行我的一个AppEnigne项目(python),但它将不再启动,这是我得到的堆栈跟踪。
*** Running dev_appserver with the following flags:
--admin_console_server= --port=8080 --clear_datastore
Python command: /usr/bin/python2.5
Traceback (most recent call last):
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/dev_appserver.py", line 77, in <module>
run_file(__file__, globals())
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/dev_appserver.py", line 73, in run_file
execfile(script_path, globals_)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver_main.py", line 138, in <module>
import logging
ImportError: No module named logging
我认为这可能是一个python 2.6错误,但我将路径调整为/usr/bin/python2.5
并且仍然无效。我正在运行OSX 10.6.8并拥有最新的AppEngineLauncher 1.5.4
我最近改变的唯一可能影响到这一点的是当我将我的XCode更新到最新版本时,v4.2 build 4C199
最近有其他人遇到过这个问题吗?
EDIT
我也不能从终端import logging
,同样的消息。这是Python的路径。
Chriss-MacBook-Pro:bin chris$ /usr/bin/python2.5
Python 2.5.4 (r254:67916, Aug 2 2010, 20:09:39)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', '/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python25.zip',
'/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5',
'/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-darwin',
'/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-mac',
'/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-mac/lib-scriptpackages',
'/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python',
'/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-tk',
'/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-dynload',
'/Library/Python/2.5/site-packages',
'/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/PyObjC',
'/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/wx-2.8-mac-unicode']
>>>
答案 0 :(得分:0)
感谢尼克和沃布尔,我已经明白了。我最近将我的XCode安装更新到4.2 GM版本并删除了测试版。一路上OSX忘记了gcc的安装位置,并阻止它编译像logging
这样的python模块。这导致.pyo
内的/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python25/logging
个文件丢失,导致import logging
无效。
记录不是唯一未编译的模块,只是AppEngine尝试导入的第一个模块。
解决方案:卸载并彻底安装XCode。确保在你的PATH上找到gcc,一切都应该没问题。