I needed to have Python 2.5 for an
App Engine project. My test virtual machine is running Ubuntu 10.10 with Python 2.6.5 so I decided to install Python 2.5 and use
virtualenv to manage different development projects. Obviously this wasn't going to be that simple. Firstly I installed Python 2.5 using a convenient staging area. I prefer /usr/local/src:-
$ cd /usr/local/src
$ sudo wget http://www.python.org/ftp/python/2.5.5/Python-2.5.5.tgz
$ sudo tar -xzf Python-2.5.5.tgz
$ cd Python-2.5.5
$ sudo ./configure --prefix=/usr/local/python2.5
$ sudo make
$ sudo make test
And I saw the first problem:-
test_zlib skipped -- No module named zlib
This meant I also had to install zlib:-
$ cd /usr/local/src
$ sudo wget http://zlib.net/zlib-1.2.5.tar.gz
$ sudo tar -zxf zlib-1.2.5.tar.gz
$ cd zlib-1.2.5
$ sudo ./configure
$ sudo make
$ sudo make install
This improved things a bit, but I still had a failure with the zlib test:-
test test_zlib failed -- Traceback (most recent call last):
File "/usr/local/src/Python-2.5.5/Lib/test/test_zlib.py", line 72, in test_baddecompressobj
self.assertRaises(ValueError, zlib.decompressobj, 0)
AssertionError: ValueError not raised
A bit more research showed that
changes in zlib after 1.2.3 caused the zlib test to fail. Sadly the fix was not being backported to 2.5, meaning that I had to change the test manually:-
$ cd/usr/local/src/Python-2.5.5/Lib/test
$ sudo joe test_zlib.py
Go to line 72, change 0 to -1 on that line, save and exit.
Now the zlib test passed, and Python 2.5 can be installed:-
$ cd /usr/local/src/Python-2.5.5
$ sudo make install