I'm trying to set up a Python development environment on Ubuntu 14.04. I wanted to install the latest version of Python 2 (2.7.11) alongside the OS version so I followed the instructions here: How to use Latest Python 2.7.x “The Right Way” on Ubuntu 12.04 LTS? The basic steps were:

sudo add-apt-repository ppa:fkrull/deadsnakes-python2.7
sudo apt-get update
sudo apt-get install python2.7

I thought this would install a second copy in addition to the default 2.7.6 (like how Hombrew works in MacOS), but now when I run python --version I get 2.7.11. which python returns /usr/bin/python, same for which python2.7. Nothing is visibly broken in the OS but I was hoping to avoid this sort of collision. Is there a better way of doing this?

UPDATE: I see now that in the release notes it says "KEEP IN MIND that this PPA will replace a core system component (i.e. Python 2.7)!" I guess that is by design, but I am still wondering if there's a less disruptive way of installing the latest Python 2.7 via package manager.

2 Answers 2



Below is only to upgrade Python2 to the latest version!

The below process should not be used to install Python3 as Python3 is incompatible with Python2 and things will break (if you're not very, very careful)

Installing Dependencies:

sudo apt-get install build-essential checkinstall
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev

Downloading Python:

cd ~/Downloads/
wget https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tgz

Extracting archive:

tar -xvf Python-2.7.12.tgz
cd Python-2.7.12

Build and install:

sudo checkinstall
  • 2
    Already upvoted, but I would add a warning that installing python 3 and removing python 2 is dangerous...
    – Fabby
    Mar 2, 2017 at 9:32
  • 1
    No no no, we are not removing python 2 Mar 2, 2017 at 9:52
  • 1
    I know, you know but the next person googling "python install Ubuntu" will now get your answer, so I would still add a warning... ;-)
    – Fabby
    Mar 3, 2017 at 13:04
  • voted your comment for that. Mar 3, 2017 at 13:06
  • That's what I meant! ;-)
    – Fabby
    Mar 3, 2017 at 13:11

There are some instructions on doing this here. It suggests compiling python 2.7.11 from the source and creating a virtual environment in which to use it.

  • Thanks for the link.If possible I'd prefer to use a package manager, but this sounds like a good alternative if that doesn't work.
    – serverpunk
    Feb 3, 2016 at 20:53
  • Please quote the most relevant parts of the links, do not rely on external sites! How to Answer
    – Melebius
    Mar 2, 2017 at 10:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .