How to Install Python 3.7.2 in Ubuntu 18.04 / 18.10

February 22, 2019 — 4 Comments

This quick tutorial is for those who want to install the latest Python 3.7.2 in Ubuntu 18.04 LTS, Linux Mint 19.x, and Ubuntu 18.10.

Ubuntu 18.04 comes with Python 2.7 and Python 3.6 out-of-the-box, and later includes Python 3.7.1 in its updates (universe) repository.

For the updated Python 3.7.2, you can do following steps to use the ToolChain PPA packages.

1. Open terminal either via Ctrl+Alt+T keyboard shortcut or by searching for “Terminal” from app launcher. When it opens, run command to add the ToolChain PPA:

sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa

Type user password (no visual feedback) when it asks and hit Enter to continue.

2. Then run command to install Python3.7:

sudo apt install python3.7

For Linux Mint 19.x, run command sudo apt update to check updates first.

3. As the PPA contains other updates toolchain packages, e.g., gcc-7.4.0, gcc-8.2.0, and python-3.6.8, you may remove the PPA afterwards via Software & Updates -> Other Software tab.

4. To make python3 use the new installed python 3.7.2 instead of the default 3.6.7, run commands to add python3.7 as choice:

This step may cause issues that depends python3.6! As I know, terminal won’t launch afterwards unless you recreate a symlink to python3.6
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1

sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 2

Then switch between the two versions via command:

sudo update-alternatives --config python3

That’s it. Enjoy!

I'm a freelance blogger who started using Ubuntu 5+ years ago and wishes to share my experiences and some useful tips with Ubuntu beginners and lovers. Please notify me if you find any typo/grammar/language mistakes. English is not my native language. Contact me on Google Plus or email to

4 responses to How to Install Python 3.7.2 in Ubuntu 18.04 / 18.10

  1. Hi and thank you for the walkthrough!
    As announced, the terminal doesn’t open anymore; how do I recreate a symlink to python3.6 (or otherwise make the terminal open again?

    Thanks in advance.

    • For Ubuntu 18.04, open terminal and run following 2 commands:

      sudo rm /usr/bin/python3
      sudo ln -s python3.6 /usr/bin/python3
  2. I have the same problem, the gnome terminal could not be opened more. This made missed module named apt_pkg. I end up installed ubuntu again.

  3. root@ubuntu:~# apt-get install python3.7
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    E: Unable to locate package python3.7

Leave a Reply

Text formatting is available via select HTML.

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>