How to update Python to the latest version on Ubuntu 18.04

247,833

Python 3.7.1 is still in maintenance version.

It is only available for download to Windows and macOS users. Once the stable version is released, then it is made available in Linux repositories.

For Windows and Mac users visit this python.org URL.

For Linux users: you can download the 3.7.0 version from the terminal

sudo apt-get update && sudo apt-get upgrade
sudo apt-get install python3.7
Share:
247,833
Ahmed Ashraf
Author by

Ahmed Ashraf

Updated on September 18, 2022

Comments

  • Ahmed Ashraf
    Ahmed Ashraf over 1 year

    The current version of python I've now which is installed by default with Ubuntu is 2.7rc1 ,
    Is it possible to update it officially to the latest version (3.7.1) ?

    Thank You .

    • Admin
      Admin over 5 years
      Python 3.x is contained in the package called "python3". Currently, it looks like it is version 3.6.5. You can have this package and Python 2 co-existing.
    • Admin
      Admin over 5 years
      What are the results of python3 -V ? They should show that you already have Python 3.6.6 installed in 18.04.
    • Admin
      Admin over 5 years
      @Ray I think you should change your comment to an answer to the question
    • Admin
      Admin over 5 years
      Thanks for your attention, I'm a new Ubuntu user, Can you please explain in detail what should I exactly do ?
    • Admin
      Admin over 5 years
      You should read the duplicate question link. Asking us to "explain in detail" something that we have already explained in detail seems a bit...um....
    • Admin
      Admin over 5 years
      @AhmedAshraf I hope what I said below helps. But, if you're a new Ubuntu user then I don't suggest you dive into the latest Python. I think for your needs, any Python 3.x will do. If you reach a stage where you're more familiar with Ubuntu and the latest version in the repository isn't good enough for you, then you can consider the latest release. I presume when you reach that stage, you are purposely after features in 3.7.1 that isn't in 3.6.5 . If you don't know (or care) about the difference, then below should help you.
    • Admin
      Admin over 5 years
      @karel It is possible that someone does not have Python 3 installed. Unlikely but possible. But I added information about locating the Python 3 executable in my answer. Thanks!
    • Admin
      Admin over 5 years
      @user535733 I'm sorry for this, I already read the duplicate question and there was some terms I didn't understand like ( apt-get, source tar ball, pseudo package, PPA , ... etc ), But I followed the instructions in the answer below and everything is fine now, Thank you :)
    • Admin
      Admin over 5 years
      @AhmedAshraf You're welcome! Unfortunately, I wrote a slightly longer reply in response to your query for more information, but it got deleted by moderators. But I'm glad you were able to get the information you needed!
  • Mohammad Heydari
    Mohammad Heydari over 5 years
    it worked on my UBUNTU 18.4 LTS
  • Santropedro
    Santropedro almost 5 years
    There is a newer python stable now than this answer.
  • baldy
    baldy about 4 years
    just change the second command to the latest stable version instead of python3.7, currently 3.8