what is the easiest way to install multiple Python versions?

Albert-Jan Roskam fomcl at yahoo.com
Thu Oct 16 04:42:31 EDT 2014



----- Original Message -----

> From: Chris Angelico <rosuav at gmail.com>
> To: 
> Cc: Python <python-list at python.org>
> Sent: Sunday, October 12, 2014 4:20 PM
> Subject: Re: what is the easiest way to install multiple Python versions?
> 
> On Mon, Oct 13, 2014 at 12:33 AM, Albert-Jan Roskam
> 
> <fomcl at yahoo.com.dmarc.invalid> wrote:
>>  *) Make altinstall
>>  sudo apt-get install libsqlite3-dev libbz2-dev libgdbm-dev libncurses5-dev 
> tk-dev zlib1g-dev
>>  wget https://www.python.org/ftp/python/2.6.8/Python-2.6.8.tgz
>>  tar -zxvf Python-2.6.8.tgz
>>  cd Python-2.6.8/
>>  ./configure --prefix=/usr/local
>>  make  # see 'failed stuff' below
>>  sudo make altinstall
>>  mkvirtualenv -p /usr/local/bin/python2.6 python26  # ImportError: No module 
> named zlib
>> 
>> 
>>  # Failed stuff
>>  Failed to find the necessary bits to build these modules:
>>  _bsddb            _curses            _curses_panel
>>  _hashlib          _sqlite3          _ssl
>>  bsddb185          bz2                dbm
>>  dl                gdbm              imageop
>>  linuxaudiodev      ossaudiodev        readline
>>  sunaudiodev        zlib
> 
> 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?


> This is in place of your explicit "apt-get install" command; Debian
> keeps track of the dev packages needed to rebuild a given program, and
> will go fetch them for you.
> 
> After that, just look at exactly what packages you're still lacking.
> You may well find that you don't have all the dependencies for all
> Python modules, as some of them might not be included in a basic
> "apt-get install python" installation; the solution is a bit more
> "apt-get build-dep" work, or some manual hunting down of dev packages
> (which may well be easier in some situations).
> 
> 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 believe Squeeze ships 2.6 as its standard system Python, so it's
> even easier. Are you on the unreleased Jessie? And why do you even
> need 2.6 as opposed to 2.7?



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.

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!



More information about the Python-list mailing list