Python Switch/Change Version in Linux and Unix with update-alternatives

February 11th, 2012 by Regaz

We expose a Canonical way to Manage Multiple Versions of a program or Multiple Similar programs on Linux.

Requisite: update-alternatives

The package update-alternatives should be present by Default in your System but if you want to check:

which upadate-alternatives

Documentation about update-alternatives ->

To Manage you Python Versions in Linux you need to let Know to update-alternative the List of elements of this Group and their level of Preference.

Here for Example we suppose you have installed python2.4, python2.6 and python2.7.

First open a Terminal window and Switch to SuperUser with:

su -

Now to Set update-alternatives on this Python Group you perform:

update-alternatives --install \
/usr/bin/python python /usr/bin/python2.4 10
update-alternatives --install \ /usr/bin/python python /usr/bin/python2.6 20
update-alternatives --install \ /usr/bin/python python /usr/bin/python2.7 30

Next after update-alternatives is Configured to Change the Python Version:

update-alternatives --config python
To Get some Extra-Insight Look this other Guide:
Getting-Started with Selenium Python Webdriver