[英]Error importing simplejson after upgrading to appengine dev server 1.7.6
I just upgraded to the App Engine Python Development server version 1.7.6 on OS X, and since upgrading, I'm receiving the following error when I try to run my app: 我刚刚在OS X上升级到App Engine Python Development服务器版本1.7.6,并且自升级以来,当我尝试运行我的应用程序时收到以下错误:
ERROR 2013-04-02 04:05:14,268 wsgi.py:219]
Traceback (most recent call last):
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/runtime/wsgi.py", line 196, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/runtime/wsgi.py", line 255, in _LoadHandler
handler = __import__(path[0])
File "/Users/rmorlok/Dropbox/ryanroot/ryan-projects/Development/docalytics/online/main.py", line 13, in <module>
from google.appengine.tools import dev_appserver
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py", line 62, in <module>
import simplejson
ImportError: No module named simplejson
I made sure that simplejson is installed by running 我确保通过运行安装simplejson
sudo pip install simplejson
which completed successfully. 哪个成功完成。 I can successfully import simplejson if I run Python on the console and import it, but when running my app via PyCharm or the GoogleAppengineLaunch, I get the above error.
如果我在控制台上运行Python并导入它,我可以成功导入simplejson,但是当通过PyCharm或GoogleAppengineLaunch运行我的应用程序时,我得到上述错误。
Does anyone know what's going on? 有谁知道发生了什么?
SimpleJson has been renamed to Json in one of the latest versions. SimpleJson已经在最新版本中重命名为Json。 If you don't update to the latest version of simplejson you wouldn't have this problem.
如果您没有更新到simplejson的最新版本,则不会出现此问题。 So you can revert to a earlier version or you can add the following to the top of the python file that gives the problem:
所以你可以恢复到早期版本,或者你可以将以下内容添加到python文件的顶部,提出问题:
import json as simplejson
Probably Google has some requirement on the versions when you install the App Engine SDK for python. 当您为python安装App Engine SDK时,Google可能会对这些版本有一些要求。
This problem may be caused by version conflict or wrong configuration of sys.path. 此问题可能是由版本冲突或sys.path的错误配置引起的。 Here are some advises:
以下是一些建议:
/usr/local/google_appengine
and /Applications/GoogleAppEngineLauncher.app/
/usr/local/google_appengine
和/Applications/GoogleAppEngineLauncher.app/
安装两个版本 /Applications/GoogleAppEngineLauncher.app/
by default it creates a symlink in /usr/local/google_appengine
When symlink is created, check permissions and make sure your system variables are set up as needed, this topic could be helpful Configuring App Engine path for PyDev on Mac /Applications/GoogleAppEngineLauncher.app/
运行appengine启动器,默认情况下会在/usr/local/google_appengine
中创建符号链接创建符号链接时,检查权限并确保根据需要设置系统变量,主题可能有用在Mac上为PyDev配置App Engine路径 If nothing helps you need to dig deeper. 如果没有什么帮助你需要深入挖掘。 For our purposes we have customized version of launcher in our project(to avoid some staff which appengine sdk stubs in standard library).
为了我们的目的,我们在我们的项目中有自定义版本的启动器(以避免一些工作人员在标准库中添加sdk存根)。 Here it is http://pastebin.com/iU2PsGhE
这是http://pastebin.com/iU2PsGhE
Environment setup is done by those steps(both: in our case and in sdk): 环境设置由这些步骤完成(两者:在我们的例子中和在sdk中):
If nothing above helps feel free to comment this answer, we will find a solution. 如果上述任何内容都无法对此答案发表评论,我们将找到解决方案。
If you are using eclipse you have to pip install simplejson
on the console and then reset your python interpreter. 如果你正在使用eclipse,你必须在控制台上
pip install simplejson
然后重置你的python解释器。 To do this you must: 要做到这一点,你必须:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.