zlib module missing - python 2.4.3
I am trying to get simplejson installed on this python 2.4.3 - I cannot upgrade, I know it is old, there is nothing I can do about it, it is not my fault, please help. however when i do the ..\python.exe .\setup.py install i get:
File "C:\Program Files (x86)\WorldViz\Vizard30\bin\lib\zipfile.py", line 188, in __init__ raise RuntimeError,\
RuntimeError: Compression requires the (missing) zlib module
Does anyone know how can I get zlib installed on this windows 64 machine? or where I can get a compiled version of simplejson or where can I find a compatible alternative for it.
Again, I can't do anything about it being python 2.4.3 - it is a proprietary modified ver开发者_如何学编程sion of python that I cannot do a thing about.
Copying the .py files into site-packages will get some stuff to work - particularly you can read files from an uncompressed zip archive, but you will not be able to inflate compressed files. The problem you are having is that ./config is not finding zlib.so (or possibly zlib.h) where it expects to find it and skips making it. This is a problem in compiling old versions of Python (pre 2.6) on recent Ubuntu boxes (Natty Narwhal - 11.0 in particular) since Canonical restructured the /lib directory contents to better (for them) support multiple architectures. So config is looking for the file /lib/libz.so and it is in /usr/lib/i386-linux-gnu/libz.so (or some other /usr/lib/$ARCH/ directory depending upon your machine).
It is supposed to be possible to tell config additional directories to search by exporting shell variables. I couldn't get that to work. What did work was the nasty hack
ln -s /usr/lib/i386-linux-gnu/libz.so /lib/libz.so
There are other parts of the standard library that config considers optional that are affected by this, but I didn't have time to track them down. After you do "make" do a "make test" and at the end it will list which packages were expected on Linux that it did not find.
The zlib
module comes in the Standard Library, and I do not see a separately installable version on the Python Package Index. It is actually integral to Python, since Python cannot run its own Standard Library without it if the library is distributed as a ZIP file, so this must be a very customized Python if it lacks it. Could you build normal Python from source in another directory and in the presence of the library files for zlib, and then copy the zlib.so
file over to see if it will link against this crazy Python you are using?
Edit: And, come to think of it, why do you need a compiled version of simplejson? Is the plain Python version not enough?
Edit: Here is how I can install simplejson
without trying to get its accelerator routine to compile:
$ wget http://pypi.python.org/packages/source/s/simplejson/simplejson-2.1.1.tar.gz
$ tar xvfz simplejson-2.1.1.tar.gz
$ cd simplejson-2.1.1
$ cp -r simplejson /usr/lib/python2.4/site-packages
Those first three steps can all occur on some other system, and of course you can just use your web browser rather than wget
. But the point is that you can just copy the whole simplejson
directory from inside of the .tar.gz
into your site-packages
and it should work. It's a messy way to manually install, but it sure won't depend on any other dependencies! :-)
精彩评论