Pages

Monday, October 26, 2009

Installing multiple versions of Python from Source

The first step is to ensure that all dependencies are installed. Run the following once:

sudo apt-get build-dep python2.5

That will install a bunch of dev packages. Which packages get installed will likely depend of each specific system.

As the remaining commands will need to be repeated for each version of python, I will list them once with X's in place of the version numbers. Be sure to replace the X's with the appropriate version numbers. The various versions and download links can be found on the Python download page.

wget http://python.org/ftp/python/X.X.X/Python-X.X.X.tgz

tar xvfz Python-X.X.X.tgz

cd Python-X.X.X

./configure --prefix=/opt/pythonX.X

make

sudo make install


In a couple versions I got some warnings after running make about missing dependencies for things I don't need or use, so I ignored them and everything worked fine. Of course, these need to be on my path to be useful so I created some links:

sudo ln -s /opt/pythonX.X/bin/pythonX.X /usr/bin/python-X.X

While I only needed to do the above once, I needed to install it in each version:

sudo python2.X setup.py install

No comments: