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).

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?


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).

| improve this answer | |
  • which still lets "aptitude install python-package" do it's work for 2.6 even if I have 2.5 installed. But at least I'm pretty sure now that Ubuntu is Python unfriendly;) – iElectric Sep 20 '09 at 16:53
  • Note that this breaks upgrading to 9.10! – iElectric Nov 4 '09 at 19:40

Installing multiple versions of Python on Ubuntu from Source

| improve this answer | |
  • This is first google hit and also just the way I have my current Python layout. Still, those two bugs are not avoidable with this solution. – iElectric Aug 25 '09 at 8:36

I know a number of people also use 'virtualenv' to create sub-environments with different versions and libraries.

Check it here: virtualenv

| improve this answer | |
  • 1
    In order to use virtualenv with different versions, you need binaries. I'm using virtualenv almost anywhere, just for pygtk development I need system python. – iElectric Aug 24 '09 at 18:37
  • thanks for the clarification, haven't used it myself, stuck doing .NET all day :( – Keck Aug 24 '09 at 22:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.