what is the easiest way to install multiple Python versions?

Chris Angelico rosuav at gmail.com
Sun Oct 12 10:20:05 EDT 2014


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

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?

ChrisA



More information about the Python-list mailing list