Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I eventually upgrade to 11.04 I will need to install Python 2.6 for development purposes. The 11.04 default is 2.7. Can I just install the python2.6 package alongside the default python package? I don't want anything else to depend on it, I need it for only one purpose. I will be using Distribute and virtualenv to install any further dependencies for Python 2.6.

share|improve this question
thanks for the answers; in retrospect it should have been obvious seeing as I run python3 side-by-side with no problems :) – d3vid May 5 '11 at 6:18
updated title to reflect that it applies to newer versions too – d3vid May 5 '11 at 6:23
up vote 5 down vote accepted

Run synaptic(through the application lens in unity or System -> Administration if you are using classic desktop )

search for python 2.6 in the filter at the top and mark it for installation by right clicking it, and selecting "Mark for Installation".

It should run alongside 2.7 fine as far as I'm aware, now when you need to use 2.6 invoke it directly, i.e with the command "python2.6 "

This should work, let me know if it doesn't though. :)

share|improve this answer
thanks for the edit :) i'm new to unity so i'm not used to talking to people in terms of the new GUI – Grant May 3 '11 at 15:48
for anyone applying the question to an older version of Ubuntu or via the Gnome 2 desktop, Synaptic is available under System / Administration / Synaptic Package Manager – d3vid May 5 '11 at 6:16
Or just click here for any newer version: . – Agmenor Nov 11 '11 at 1:47

VirtualEnv is the definitely best way to have multiple python versions, even it it is the same interpreter but with different installed libraries. In each virtual environment you will run the selected python version. Every thing will be transparent.

BTW: you can find a repository with very old python version here:

Maybe it will be useful for someone.

share|improve this answer

Yes, you can without any problems.

You can even do system wide installs using easy_install. Just instead of invoking it directly, invoke it via python2.6 easy_install.

share|improve this answer
it's good to point that out, thanks – d3vid May 5 '11 at 6:13

for testing purpose, you would also install it locally (or not) from the sources :

download the tarball source package. Python is really easy to compile. (the trick is in the altinstall)

./configure --prefix="/home/me/python2.6"
make altinstall

then do

export PATH="/home/me/python2.6/bin":$PATH
export LD_LIBRARY_PATH="/home/me/python2.6/lib":$PATH

Plus you may want to play with virtualenv

share|improve this answer

You can use pyenv to do this too. I rather simple and also it allows you to switch versions and control your python enviroment. To install and use:

  1. Install the dependencies of python, to prevent weird messages:

    sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev git
  2. Install pyenv. Sadly this application doesn't have package that you could just apt-get away, but still it's easy to install:

    mkdir $HOME/.pyenv
    cd $HOME
    git clone git:// .pyenv

    the following is bash exclusive. If you use another shell you must modify the .bashrc entries.

    echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
    echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
    echo 'eval "$(pyenv init -)"' >> ~/.bashrc
  3. Restart the shell:

    exec $SHELL
  4. Check that the installation is ok:

    ➜  ~  pyenv --version
    pyenv 0.4.0-20140110.1-14-g46a01b1
  5. Install python versions away:

    ➜  ~  pyenv install 2.7.6                                    
    Downloading Python-2.7.6.tgz...
    Installing Python-2.7.6...
    Installed Python-2.7.6 to /home/braiam/.pyenv/versions/2.7.6
    Downloading setuptools-2.1.tar.gz...
    Installing setuptools-2.1...
    Installed setuptools-2.1 to /home/braiam/.pyenv/versions/2.7.6
    Downloading pip-1.5.tar.gz...
    Installing pip-1.5...
    Installed pip-1.5 to /home/braiam/.pyenv/versions/2.7.6
  6. Done. Now you may want to do pyenv rehash. Also use pyenv versions, since this will show all the versions possible. pyenv local 2.7.6 will set the version of python used by the current directory and below to that version.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.