在 google appengine 上安装 simplejson

发布于 2024-08-29 21:24:45 字数 495 浏览 2 评论 0原文

超级牛逼的提问时间!我正在尝试在 google appengine 上使用 simplejson 。在我机器上的终端中,我安装了 simplejson 并正在运行。但是当我尝试将其导入到应用程序引擎上运行的脚本中时,我收到一条错误消息,指出不存在这样的库。如果在我的计算机上打开交互式控制台(来自 http://localhost:8080/_ah/admin)并输入“import simplejson”我得到:

Traceback(最近一次调用最后一次): 文件“/home/chris/google_appengine/google/appengine/ext/admin/init.py”,第 210 行,帖子中 exec(编译代码,全局变量()) 文件“”,第 1 行,位于 ImportError:没有名为 simplejson 的模块

有什么想法吗?

Super nub question time! I am trying to use simplejson on the google appengine. In a terminal on my machine I have simplejson installed and working. But my when I try to import it in a script running on the appengine I get an error saying no such library exists. If open the interactive console on my machine (from the link on http://localhost:8080/_ah/admin) and type "import simplejson" I get:

Traceback (most recent call last):
File "/home/chris/google_appengine/google/appengine/ext/admin/init.py", line 210, in post
exec(compiled_code, globals())
File "", line 1, in
ImportError: No module named simplejson

Any thoughts?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

宛菡 2024-09-05 21:24:45

查看 django 包:

from django.utils import simplejson as json
obj = json.loads(json_string)

由于 Sdk 1.4.2 Json 可以使用以下语句导入:

import simplejson

请注意,在 Python 2.7 运行时,您可以使用 原生 Json 库

Look in django package:

from django.utils import simplejson as json
obj = json.loads(json_string)

Since Sdk 1.4.2 Json can be imported with the following statement:

import simplejson

Note that on Python 2.7 runtime you can use the native Json library.

望她远 2024-09-05 21:24:45

您不再需要在 Google App Engine 上使用 simplejson 的 django 包。

import simplejson as json

这对于避免日志文件中出现有关 django 版本的大量警告非常方便。

You no longer need to use the django package for simplejson on Google App Engine.

import simplejson as json

This is expecially handy for avoiding the flurry of warnings about django versions in your log file.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文