Blog Entry

Finally, python version selection using update-alternatives

miércoles, enero 14, 2009 by , under

Introduction

Finally, I managed to configure the python version selection using update-alternatives on Ubuntu 8.04. My new work at iservices involves developing apps in Plone, BUT, the entire plone framework that we are using here is highly dependent in Python 2.4.
If we try to use Python 2.5 as default in (/usr/bin/python) things will break in Plone. On the other hand, Ubuntu 8.04 and a lot of system utilities are highly dependent on python 2.5 and things will also break at system level (for example, ufw).

The solution
I did not read the manpage adequately because I am getting lazy so I went to ask google and this page gave the main hints: http://ubuntuforums.org/archive/index.php/t-315362.html

So, these are the steps at my console:
  • First, I checked if there was a previous configuration (somehting like a 'out of the box' configuration). As you will see, there are none.


tzicatl@laptop:~$ sudo update-alternatives --config python
No hay alternativas para python.

  • Next step is to configure the two alternatives


tzicatl@laptop:~$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.4 10
tzicatl@laptop:~$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.5 1

  • Now I recheck the configuration, choose one of them and see if it worked (Python2.4 was selected at that time so I tried switching to python 2.5).


tzicatl@laptop:~$ sudo update-alternatives --config python

Hay 2 alternativas que proveen `python'.

Selección Alternativa
-----------------------------------------------
*+ 1 /usr/bin/python2.4
2 /usr/bin/python2.5

Pulse para mantener el valor por omisión [*] o pulse un número de selección: 2
Se utiliza `/usr/bin/python2.5' para proporcionar `python'.
tzicatl@laptop:~$ python
Python 2.5.2 (r252:60911, Oct 5 2008, 19:24:49)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
  • Now let's check if it works the other side.
tzicatl@laptop:~$ sudo update-alternatives --config python

Hay 2 alternativas que proveen `python'.

Selección Alternativa
-----------------------------------------------
+ 1 /usr/bin/python2.4
* 2 /usr/bin/python2.5

Pulse para mantener el valor por omisión [*] o pulse un número de selección: 1
Se utiliza `/usr/bin/python2.4' para proporcionar `python'.
tzicatl@laptop:~$ python
Python 2.4.5 (#2, Aug 1 2008, 02:20:59)
[GCC 4.3.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

  • Listo!!! Problem solved

0 Responses to 'Finally, python version selection using update-alternatives'