Monday 4 October 2010

Running Python 2.7 on Debian

Here are some quick notes about how I got Python 2.7 running on Debian.  The pointers come from the Python NW Google Group and the Debian documentation.

(1) Set up the apt/sources.list file as follows:

deb unstable main contrib non-free
deb experimental main contrib non-free
deb testing/updates main contrib

(2) Run aptitude and do an upgrade to refresh the package lists
(3)  I had 45 packages to update so I installed them all
(4) That left me with python 2.6 installed
(5) Searched in aptitude for python 2.7.  Marked it for installation
(6) Aptitude seemed to nicely manage all the dependencies.

With the above complete 'python --version' reports 2.6 and 'python2.7 --version' reports 2.7.

I'll keep the virtual box snapshot of the previous version about for a while just in case.


Anonymous said...

Sorry, but updating your whole system to unstable/experimental is not very good way to get one software to current version :-)

Dave Potts said...

It is a really good point. I should say that what I'm updating is just a development area I use for hobby work. Also, I run the system in VirtualBox so by keeping snapshots I can painlessly recover from something messing up an install.

I had been running unstable to start with and just needed the path of least resistance to get Python 2.7 working (for the improved unittest library mostly). So far the method above seems to have work and certainly was straight forwards to do. I agree however that it is not suitable for critical environments.

Anonymous said...

In that kind of environment it is of course ok. But still, it is really frustrating that Linux distributions are lagging so badly behind with Python versions.

There was a good article about it recently:

Every week I am in a situation that I could do something easier in Python 2.6/2.7, but I am stuck with 2.5 because of Debian we're using in production.

Dave Potts said...

Thank you for the link, and I concur with the sentiment. I would have much preferred to not even have to think about how to get python 2.7 on Debian.

If it is any consolation, on my, admittedly minimal, dev environment I've not encountered any problems...yet.