what is the easiest way to install multiple Python versions?

Chris Angelico rosuav at gmail.com
Thu Oct 16 10:48:31 CEST 2014


On Thu, Oct 16, 2014 at 7:42 PM, Albert-Jan Roskam <fomcl at yahoo.com> wrote:
>
>> From: Chris Angelico <rosuav at gmail.com>
>> Generally, this is the method I would recommend. For a start, run this:
>>
>> sudo apt-get build-dep python
>
> Aha, useful tip. But won't this (re)build the dependencies of the default python version?
> Or should I do sudo apt-get build-dep python-2.6?

It would install (not usually build) all the dependencies of the
default Python, yes; but if you're compiling from source, that's
usually going to be fairly close. For instance, if you want to build
Python 3.5 from Mercurial, the easiest way to get started would be
"apt-get build-dep python3"; that might not get absolutely everything,
but it's sure going to be close. Python's dependencies don't change
hugely between minor versions.

>> But what version of Debian are you after, and why are you trying to
>> build a 2.6.8 from source? On Debian Wheezy, getting hold of Python
>> 2.6 should be as easy as:
>>
>> $ sudo apt-get install python2.6
>
> I am on Debian 7.6, Wheezy (Linux debian 3.2.0-4-amd64 #1 SMP Debian 3.2.60-1+deb7u3 x86_64 GNU/Linux). Wow, so it is really this simple? This was actually the first option I considered, but I was sooooo paranoid to ruin my default Python version.
>

I'm fairly sure - though you could easily confirm - that installing
the python2.6 package won't fiddle with the name "python", nor the
name "python2", but will simply add another name "python2.6". I have
it installed on my main Wheezy system, and that's how it is. Not sure
if there's a way to tweak that with update-alternatives or anything.

> Reason why I need Python 2.6? The script needs to run on a server that turned out to have Python 2.6. It is beyond my power to upgrade the Python version.
>
> Thanks all!

Fair enough. The differences between 2.6 and 2.7 aren't great, though,
so you may well be able to port it trivially. But in any case, so long
as you have Wheezy, you should be able to run 2.6 the easy way.

ChrisA



More information about the Python-list mailing list