Configure and compile Python with Zlib
by Greg on Jun.26, 2005, under Linux, Python, Zope
I just spent an hour trying to figure this out, AGAIN! To compile Zlib support into your Python interpreter, do this:
1. Install the Zlib-dev package for your distribution. (you probably have zlib already, but not the dev package)
On Ubuntu it’s called ‘zlib1g-dev’, on others it might just be: zlib-dev or zlib-devel. Do a search on your distro package lists to find it.
You should end up with a ‘zlib.h’ file in your system. In mine, Ubuntu, I have /usr/include/zlib.h
2. Get your python sources to compile and run the configure script like so:
./configure –with-zlib=/usr/include
See there that I included the ‘/usr/include’ directory to find zlib.h in? After the make && make install it worked great!
Keep in mind your mileage may vary, but this might help I hope. More importantly, now I can remember how I did this! :)
September 1st, 2007 on 3:27 am
Originally posted by Nico:
It worked !!!! if you were a girl I would kiss you
thnx mate
April 15th, 2008 on 8:30 am
just wasted half a day on this myself – another pointer for those having trouble re-installing, make sure to unset your PYHTONHOME and PYHTONPATH env vars … son of a …
July 21st, 2009 on 12:37 am
Thanks! This was driving me nuts :-/
April 14th, 2010 on 2:44 pm
Thanks!! I did a clean install of Python 2.6.5 and was getting
ImportError: No module named zlib
but then I followed your instructions, reinstalled python, and now it works.