For newer Python I prefer the deadsnake ppa. For installing it, try this:

sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.7
$ python3.7 -V
Python 3.7.7
Answer from moep on askubuntu.com
Top answer
1 of 2
37

For newer Python I prefer the deadsnake ppa. For installing it, try this:

sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.7
$ python3.7 -V
Python 3.7.7
2 of 2
4

The Python 3.7 package from the official Ubuntu 19.10 repositories can be installed in Ubuntu 20.04 without adding any new repositories to your software sources by running the following commands:

sudo apt update  
wget -c http://mirrors.kernel.org/ubuntu/pool/main/libf/libffi/libffi6_3.2.1-9_amd64.deb http://security.ubuntu.com/ubuntu/pool/main/p/python3.7/libpython3.7-stdlib_3.7.5-2~19.10ubuntu1_amd64.deb http://security.ubuntu.com/ubuntu/pool/main/p/python3.7/libpython3.7-minimal_3.7.5-2~19.10ubuntu1_amd64.deb http://security.ubuntu.com/ubuntu/pool/main/p/python3.7/python3.7-minimal_3.7.5-2~19.10ubuntu1_amd64.deb http://security.ubuntu.com/ubuntu/pool/main/p/python3.7/python3.7_3.7.5-2~19.10ubuntu1_amd64.deb
sudo apt install ./libffi6_3.2.1-9_amd64.deb ./libpython3.7-minimal_3.7.5-2~19.10ubuntu1_amd64.deb ./libpython3.7-stdlib_3.7.5-2~19.10ubuntu1_amd64.deb ./python3.7-minimal_3.7.5-2~19.10ubuntu1_amd64.deb ./python3.7_3.7.5-2~19.10ubuntu1_amd64.deb

Add Python 3.7 to update-alternatives so that you can switch between Python 3.8 and Python 3.7 by running update-alternatives --config python3.

sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7
update-alternatives --config python3
Discussions

Python 3.7 on Ubuntu 20.04 - Stack Overflow
I am preparing a docker image for Ubuntu 20.04 and due to TensorFlow 2.0 requirement, I need Python 3.7. TensorFlow runs on Python 3.5 to 3.7. Running apt install python3 installs Python 3.8 by def... More on stackoverflow.com
🌐 stackoverflow.com
Installing a python 3.7 virtual environment on a Linux machine with python 2.7 - Stack Overflow
I wonder how I can install a python 3.7 virtual environment on a Linux machine that currently has python 2.7? I also do not have sudo privilege. More on stackoverflow.com
🌐 stackoverflow.com
Help with installing python 3.7
Which Distro are you running on the Pi? Maybe you need to add a repository first if no python 3.7 is available in the default repos. Also check which Version of python do you have by putting this in a Script and run it: https://stackoverflow.com/questions/1093322/how-do-i-check-what-version-of-python-is-running-my-script#1093331 More on reddit.com
🌐 r/linux4noobs
7
2
April 27, 2020
how to install python 3.7 on ubuntu 21.04? thx
21.04 is EOL. More on reddit.com
🌐 r/Ubuntu
7
0
March 15, 2022
🌐
Python
python.org › downloads › release › python-370
Python Release Python 3.7.0 | Python.org
For 3.7.0, we provide two binary installer options for download. The default variant is 64-bit-only and works on macOS 10.9 (Mavericks) and later systems. We also continue to provide a 64-bit/32-bit variant that works on all versions of macOS from 10.6 (Snow Leopard) on.
🌐
GitHub
gist.github.com › j40903272 › a4b715b79b2e5aa74342fe995a1c1ef9
Install python3.7 · GitHub
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 sudo update-alternatives --config python3 ... sudo apt-get install -y build-essential ...
Find elsewhere
🌐
Linuxize
linuxize.com › home › python › how to install python 3.7 on ubuntu 18.04
How to Install Python 3.7 on Ubuntu 18.04 | Linuxize
October 15, 2019 - Python 3.7 includes many new features such as postponed evaluation of type annotations, support for data classes and context variables, customization of access to module attributes, and more . This tutorial describes two ways of installing Python 3.7 on Ubuntu 18.04: By using the standard apt tool from the deadsnakes PPA, and by building from the source code.
🌐
Python
python.org › downloads
Download Python | Python.org
Python 3.13.8 Oct. 7, 2025 Download Release notes
🌐
GeeksforGeeks
geeksforgeeks.org › python › how-to-download-and-install-python-latest-version-on-linux
How to Download and Install Python Latest Version on Linux? - GeeksforGeeks
October 6, 2021 - There can be multiple methods to ... definitely. $ sudo add-apt-repository ppa:deadsnakes/ppa $ sudo apt-get update $ sudo apt-get install python3.7...
🌐
Source Digit
sourcedigit.com › home › how to install python 3.7 in ubuntu linux
How To Install Python 3.7 in Ubuntu Linux
April 27, 2019 - sudo add-apt-repository ppa:deadsnakes/ppa sudo apt-get update sudo apt-get install python3.7 · Run the following commands in terminal to install Python 3.6 using PPA in Ubuntu and Linux Mint and other Ubuntu Derivatives.
🌐
Antonio's IT Blog
antonioyan.wordpress.com › 2020 › 08 › 18 › how-to-install-python-3-7-on-ubuntu-debian-and-linuxmint
How to Install Python 3.7 on Ubuntu, Debian and LinuxMint | Antonio's IT Blog
August 18, 2020 - sudo apt-get install wget ... libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev · Download Python using following command from python official site....
🌐
TecAdmin
tecadmin.net › install-python-3-7-amazon-linux
How to Install Python 3.7 on Amazon Linux – TecAdmin
April 26, 2025 - The new binary will be installed at /usr/local/bin/python3.7 location: ... Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp ... Excellent…it worked perfectly. ... you can either use ‘yum install ‘ to install modules directly from pkg manager repositary or use the more familiar way ‘pip3 install ‘ or ‘python3 -m pip install ...
🌐
Errbufferoverfl
errbufferoverfl.github.io › snake-charming › installing_python_three_point_seven.html
Installing Python 3.7 — Snake Charming for Beginners 1.0.0 documentation
If the version is Python 2.x.x or Python 3.x.x is not installed or is not Python 3.7.x at the latest, then you will want to install the latest version. How you do this will depend on the flavour of Linux you are currently using.
🌐
Python
python.org › downloads › release › python-377
Python Release Python 3.7.7 | Python.org
Please read the "Important Information" displayed during installation for information about SSL/TLS certificate validation and the running the "Install Certificates.command". As of 3.7.7, we provide one installer: 64-bit-only that works on macOS 10.9 (Mavericks) and later systems.
🌐
DEV Community
dev.to › serhatteker › how-to-upgrade-to-python-3-7-on-ubuntu-18-04-18-10-5hab
How to Update Python: How to Upgrade to Python 3.7 on Ubuntu 18.04/18.10 - DEV Community
January 11, 2021 - $ 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 · By default, Python 3.6 is pointed to Python 3.
🌐
Red Hat
developers.redhat.com › blog › install-python3-rhel
How to install multiple versions of Python on Red Hat Enterprise Linux | Red Hat Developer
February 27, 2024 - Let's go ahead and install Python 3.9 on RHEL 8: ... Verify this specific installation using: python3.11 --version. In addition, for installing the pip package installer, add on the -pip extension to the version of python being installed, for example: ... $ sudo subscription-manager repos --enable codeready-builder-for-rhel-8-x86_64-rpms $ yum group install "Development Tools" While Python 2.7 is the default implementation for RHEL 7, newer versions of the Python interpreter and libraries are available as Red Hat Software Collections packages.
Top answer
1 of 3
47

It would be wise to use pyenv to safely manage multiple versions of Python installed on the same system.

Nonetheless, this should get you up and running with Python 3.7.10 on Ubuntu 16.04

# WARNING: As of April 30th 2021, Ubuntu Linux 16.04 LTS will no longer supported
# NOTE: It appears that Python 3.7.* has arrived into maintenance mode and will likely
# only be getting security updates.  See release notes https://www.python.org/downloads/release/python-3710/

# Install requirements
sudo apt-get install -y build-essential \
checkinstall \
libreadline-gplv2-dev \
libncursesw5-dev \
libssl-dev \
libsqlite3-dev \
tk-dev \
libgdbm-dev \
libc6-dev \
libbz2-dev \
zlib1g-dev \
openssl \
libffi-dev \
python3-dev \
python3-setuptools \
wget

# Prepare to build
mkdir /tmp/Python37
mkdir /tmp/Python37/Python-3.7.10
cd /tmp/Python37/

# Pull down Python 3.7.10, build, and install
wget https://www.python.org/ftp/python/3.7.10/Python-3.7.10.tar.xz
tar xvf Python-3.7.10.tar.xz -C /tmp/Python37
cd /tmp/Python37/Python-3.7.10/
./configure --enable-optimizations
sudo make altinstall

Then you would just call Python like so:

python3.7 ./yourScript.py

This is a screenshot of multiple versions of Python co-existing in a docker container and how they can be distinguished:

Pip should have been installed with this installation as well. To install packages use this format:

pip3.7 -V
2 of 3
7

I would not recommend manually fiddling around with source code installations and paths. Use pyenv and save yourself the trouble.

All you have to do is:

  • Run the pyenv installer
  • Follow the instructions
  • Install the Python versions you need
  • Choose which Python version you want to use for a given directory, or globally

For example, to install 3.7, check which versions are available:

pyenv install -l | grep 3.7

Then run:

pyenv install 3.7.1

Now, you can choose your Python version:

pyenv global 3.7.1

This switches your python to point to 3.7.1. If you want the system python, run:

pyenv global system

To check which Python versions are available, run pyenv versions.

🌐
GitHub
gist.github.com › Sdoof › 6c6b38fe238cea5768b50ce4def7c6c3
Install Python 3.7 and pip, pipenv on Ubuntu 18.04 (works on WSL).md · GitHub
Register both Python 3.7 and and preinstalled Python 3.6 to python3 alternatives. 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