How can I install a debian package using specific version of python

1

1

I am trying to install a deb package I built from source, the package is call LIO-Utils.

LIO-Utils and the packages to follow require Python2.6 but Ubuntu 11.10 Server is running Python2.7.

I have already installed Python2.6 via apt-get, and when I go to install the package LIO-Utils installs to the Python2.7 directory and not the Python2.6.

Is there a way to force installation into a specific version? I cannot remove Python2.7 because alot of Ubuntu's tools are based on Python2.7

ianc1215

Posted 2011-12-27T06:34:10.440

Reputation: 2 884

Answers

1

As a rule a Linux system will depend, system-wide, on the Python version it was built with. In the case of Ubuntu 11.10 this is Python 2.7 - as you say.

dpkg (and friends) will default to installing for the default Python version set as follows:

  1. symbolic link listed in the /etc/alternatives directory
  2. the version that symbolic link /usr/bin/python is pointing at

like so:

$ ls -al /etc/alternatives | grep python
$ ls -al /usr/bin/python

You can temporarily change the default version of Python that your system utilities use by pointing the link to Python 2.6

$ sudo update-alternatives --config python

if Python 2.7 (or 2.6) does not display as choice then you have to first install it in the alternatives system. This is a guide.

Install the .deb package you built and then change the alternatives symbolic link back to the system's expected version:

$ sudo update-alternatives --config python

The subsystem that prescribes the Python version a Debian-based distro uses is discussed here

venzen

Posted 2011-12-27T06:34:10.440

Reputation: 319

I ended up using update-alternatives does this accomplish the same thing? – ianc1215 – 2011-12-27T07:20:47.430

you're absolutely correct - that primary option slipped my mind at the time i answered. I will update my answer for the sake of other users – venzen – 2011-12-27T08:02:35.270