Python Switch/Change Version in Linux and Unix With Update-alternatives

February 11, 2012 | By Duchateaux.

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 -> http://williamdemeo.github.io/linux/update-alternatives.html.

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
/nupdate-alternatives --install /usr/bin/python python /usr/bin/python2.6 20
/nupdate-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

QuickChic Theme • Powered by WordPress