How can I install extra versions of python on Debian (jessie). On Ubuntu I can use the "deadsnakes" PPA which will give me any python version I want, with the version name in the command (e.g. python33 for python 3.3). This allows me to install them all beside each other. I can use virtualenvs to install specific python packages for specific versions without messing with the system packages. I maintain some python libraries, and they need to work on many versions of python. If I have the python binary installed, then tox will take care of using virtualenvs for each python version.

So what's the debian equivalent of Ubuntu's deadsnakes PPA?

UPDATE I want to install python: 2.6, 2.7, 3.3, 3.4 and 3.5.

  • Can you specify which versions of Python you want installed? I think Jessie has a few different versions available. Mar 7 '15 at 10:07
  • In my opinion you are probably better off just installing various Python versions from source.
    – Celada
    Mar 7 '15 at 10:08

Using the PPA

You can use the PPA on Debian. Pick an Ubuntu version that's from slightly before your Debian version, and it should have all the necessary libraries. For wheezy, the oneiric PPA seems ok (but it lacks more recent Python versions). For jessie, the trusty PPA should work.

To add a PPA on Debian, create a file /etc/apt/sources.list.d/deadsnakes.list containing

deb http://ppa.launchpad.net/fkrull/deadsnakes/ubuntu trusty main 
deb-src http://ppa.launchpad.net/fkrull/deadsnakes/ubuntu trusty main 

Download the PPA signing key with

gpg --keyserver keyserver.ubuntu.com --recv-keys DB82666C

then add the key to the APT key database with

gpg --export DB82666C | sudo apt-key add -

Finally run apt-get update and install the desired packages.

If you can't get the PPA working for some reasons (maybe you can't find a version that works with the libraries you have), you can download the source and recompile them for your distribution.

Using a chrooted system

What I usually do to test compatibility with other versions is to run older or newer distributions in a chrooted system. For example, you could install various versions of Ubuntu with the Python versions you're interested in, or you could install trusty in a chroot and install the PPA there. For more information, see my schroot guide.

  • 1
    You should avoid using Ubuntu PPAs on Debian, as it might cause issues or other conflicts. (It's also possible to use pyenv virtualenvironments for multiple Python versions) Oct 7 '17 at 14:33
  • I can confirm that I have successfully installed python 2.6, 2.7, 3.1, 3.2, 3.3, 3.5 and 3.6 on current debian testing using this approach. The only caveat I came across was that I needed to dig up an old version of libssl1.0.0 which I found here: packages.debian.org/jessie/libssl1.0.0 . I also used the xenial (16.04) versions of packages (current lts), though I believe trusty still works.
    – Att Righ
    Dec 11 '17 at 16:49

I would say there is no Debian equivalent to Ubuntu's deadsnakes PPA

Under Debian, using Ubuntu packages or repositories is not recommended. As this post appears in search engines, I propose here an answer that is less dangerous for a Debian system.

Installing Python manually is possible. As an example, you can use the following instructions to install 3.5.2 version


Install dependencies :

sudo apt-get update && sudo apt-get install libssl-dev openssl

Building Python

You can build Python in a specific folder using the --prefix parameter from configure command:

wget https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz
tar zxf Python-3.5.2.tgz
cd Python-3.5.2/
./configure --prefix=/usr/local
sudo make install

Instead of /usr/local, one can use another base directory. As an example:

sudo mkdir /opt/python-3.5.2
./configure --prefix=/opt/python-3.5.2

Selecting python version

Using PATH environment variable can help choosing the right python version to use. But one can also use symlinks:

sudo ln -s /opt/python-3.5.2/bin/python3.5 /usr/local/bin/python3
sudo ln -s /opt/python-3.5.2/bin/pip3.5 /usr/local/bin/pip3

Using -f option will allow you to replace existing symlinks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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