Update Python 2.7 to latest version of 2.x

66,576

Ubuntu 18.04 and newer:

The new version of Ubuntu no longer uses python 2, so you need to install it with:

sudo apt install python-minimal

Ubuntu 17.04 and older:

The answer appears to be to add a third party repository:

sudo add-apt-repository ppa:jonathonf/python-2.7
sudo apt-get update
sudo apt-get install python2.7
python --version
Share:
66,576

Related videos on Youtube

Morgoth
Author by

Morgoth

Updated on September 18, 2022

Comments

  • Morgoth
    Morgoth over 1 year

    The version of python2 on my Ubuntu 14.04 machine is Python 2.7.6. How can I upgrade it to the the latest version of Python 2.X? The latest is currently 2.7.11.

    I have tried apt-get update/upgrade, but the repository doesn't seem to have the latest version.

    • David Foerster
      David Foerster over 6 years
      I'm voting to reopen this question because the answer to the linked question is obsolete while this one is up to date (as far as I can tell). They should either be merged or the duplicate relationship should be reversed.
    • Eliah Kagan
      Eliah Kagan over 6 years
      @DavidFoerster Done. We can vote to close that question as a duplicate of this one now, which I've done.
    • Morgoth
      Morgoth over 6 years
      @dbliss This is normal practice on stackexhange.
    • Eliah Kagan
      Eliah Kagan over 6 years
      I've removed some of my comments so any future comments will more likely be seen, and to reduce distraction from the actual Q&A here. Anyone interested may read them, in context and with continued discussion, in this chat room (transcript). I reiterate, however, that any serious concerns are better discussed--and far more likely to be resolved--on Ask Ubuntu Meta than in comments or chat.
  • Igor Pomaranskiy
    Igor Pomaranskiy about 8 years
    Error: 'fkrull/deadsnakes-python2.7' invalid
  • Igor Pomaranskiy
    Igor Pomaranskiy about 8 years
    It should be sudo add-apt-repository ppa:fkrull/deadsnakes-python2.7 (you've missed ppa:).
  • zhihong
    zhihong over 7 years
    Thanks. But it works till python 2.7.12, now the latest release is 2.7.13.
  • Enrico
    Enrico about 7 years
    Important The mentioned repository won't receive any further updates.
  • giorgiosironi
    giorgiosironi almost 7 years
    It appears this PPA has now been taken offline, launchpad.net/~fkrull/+archive/ubuntu/deadsnakes-python2.7 403
  • cmp
    cmp about 6 years
    You can use it now from launchpad.net/~deadsnakes/+archive/ubuntu/ppa but it doesn't support 2.7 releases
  • Gaia
    Gaia almost 6 years
    seems that jonathonf/python-2.7 doesn't carry the packages for bionic
  • Morgoth
    Morgoth almost 6 years
    @Gaia, Try sudo apt install python-minimal, it looks like the new way to do it. I has a newer version of python 2.7 than ppa:jonathonf/python-2.7 too.
  • Filip Savic
    Filip Savic almost 6 years
    I am using Ubuntu 14.04. Just did as the answer says for my version (17.04 and older) and I just got Python 2.7.14 which is newest version of python 2 today (15.8.2018.). Thanks! :)
  • Moshe Zvi
    Moshe Zvi about 4 years
    Unfortunately, this is no longer working as of May 2020
  • Morgoth
    Morgoth about 4 years
    @MosheZvi What version of Ubuntu are you using?