Ubuntu – Preferred way to install multiple python versions on Ubuntu Jaunty

pythonUbuntuubuntu-9.04vim

Situation: Jaunty ships with 2.6, which does not fit my needs because many libraries are still failing. I want to have a system default 2.5. Also, for testing purposes, I need 2.6, 2.5 and 2.4 installed.

Current solution:
I compiled 2.5 and 2.4 from source, and symlinked 2.5 to /usr/bin/python. I also edited some magic file that Ubuntu uses to specify Python version (don't remember now where it sits).

Problems:
First problem I'm having is that sometimes aptitude installs libraries for 2.6. In most cases, that's avoidable with suffixing -25.

But that's not always the solution, eg. Vim is compiled with 2.6, which does not have access to 2.5 libraries. There is no way to install Vim with python 2.5

Another problem I had recenty is that I installed bypthon. It was failing when using "curses" module, because it was from 2.6 library. I have no idea why/how this happens.

Anyone care to elaborate how to do proper switching of default python in Jaunty?

Best Answer

You should be able to install 2.4, 2.5, 2.6 and/or 3.0 from the repositories using Synaptic Package Manager or apt-get or aptitude then use update-alternatives to set up a default. See my answer here for information on using update-alternatives (the answer is even specific to Python).