Python 2.5 zlib 麻烦
我正在尝试使用 Bottle 在 google 应用引擎上部署一个应用程序,a 微框架,类似于flask。我正在 ubuntu 上运行 安装了python 2.7,但GAE需要2.5版本,所以我安装了 2.5.然后我意识到我没有使用 make altinstall 所以我可能有一个 现在默认版本有问题。但我真正的问题是当我尝试 使用 gae 服务器在本地进行测试 我收到以下错误:
Traceback (most recent call last):
File "/opt/google/appengine/dev_appserver.py", line 77, in <module>
run_file(__file__, globals())
File "/opt/google/appengine/dev_appserver.py", line 73, in run_file
execfile(script_path, globals_)
File "/opt/google/appengine/google/appengine/tools/
dev_appserver_main.py", line 156, in <module>
from google.appengine.tools import dev_appserver
File "/opt/google/appengine/google/appengine/tools/
dev_appserver.py", line 94, in <module>
import zlib
ImportError: No module named zlib
你能帮我解决这个问题吗?
I am trying to deploy an app on google app engine using bottle, a
micro-framework, similar to flask. I am running on ubuntu which comes
with python 2.7 installed but GAE needs version 2.5, so I installed
2.5. I then realized I didn't use make altinstall so I may have a
default version problem now. But my real problem is that when I try to
use the gae server to test locally I get the following error:
Traceback (most recent call last):
File "/opt/google/appengine/dev_appserver.py", line 77, in <module>
run_file(__file__, globals())
File "/opt/google/appengine/dev_appserver.py", line 73, in run_file
execfile(script_path, globals_)
File "/opt/google/appengine/google/appengine/tools/
dev_appserver_main.py", line 156, in <module>
from google.appengine.tools import dev_appserver
File "/opt/google/appengine/google/appengine/tools/
dev_appserver.py", line 94, in <module>
import zlib
ImportError: No module named zlib
Can you help me with this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你是如何构建 Python 2.5 的?如果您自己从源代码构建它,则
zlib
模块很可能未构建,因为您的系统上未安装必要的库和头文件。在 Ubuntu 上,您需要(我认为)
zlib1g-dev
软件包。对于各种其他模块也是如此(例如,如果没有适当的 OpenSSL 开发库/标头,您也不会获得
ssl
模块)。有人可能还拥有适合您的 Ubuntu 版本的
python2.5
软件包(尽管 Natty 或 Maverick 似乎在官方存储库中都没有该软件包)。How did you build Python 2.5? If you built it from sources yourself, there's a good possibility the
zlib
module didn't get built because the necessary libraries and header files weren't installed on your system.On Ubuntu, you need (I think) the
zlib1g-dev
package.This will be true for a variety of other modules as well (for example, without the appropriate OpenSSL development libraries/headers in place, you won't get the
ssl
module either).Someone may also have a
python2.5
package for your version of Ubuntu (although neither Natty or Maverick appear to have one in the official repositories).在发现只要不使用任何 2.5 后的语言功能或软件包(或软件包的附加内容),使用 2.5 后的 Python 就可以正常工作之前,我写了一篇为 Ubuntu 构建 2.5 的演练 此处。它包括 zlib 所需的部分。
我现在很高兴使用 Python 2.6.5(使用 SDK 1.5.4)在 Ubuntu 上进行开发。
Before figuring out that using a post-2.5 Python worked just fine as long as you didn't use any post-2.5 language features or packages (or additions to package), I wrote up a walkthrough for building 2.5 for Ubuntu here. It includes the bit you need for zlib.
I'm now happily developing on Ubuntu using Python 2.6.5 (with SDK 1.5.4).