Python 2.5 zlib trouble
I am trying to deploy an app on google app engine 开发者_JAVA百科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?
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).
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).
精彩评论