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.comI am on a raspberry pi if that makes a difference. I’d like to install python 3.7 ideally so my projects can work. I’ve googled it and sudo apt-get install python3.7 doesn’t work and I see some other meathods but it involves installing other things and I’m not exactly sure what those things are or do
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
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
Python 3.7 on Ubuntu 20.04 - Stack Overflow
Installing a python 3.7 virtual environment on a Linux machine with python 2.7 - Stack Overflow
Help with installing python 3.7
how to install python 3.7 on ubuntu 21.04? thx
Videos
Do you need Ubuntu 20.04? Ubuntu 18.04 comes with Python 3.6, and 3.7 available.
If you do, the deadsnakes PPA has Python 3.5-3.7 for Ubuntu 20.04 (Focal). To add it and install:
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get install python3.7
P.s. I'm not a dev and have no experience with Tensorflow so take this with a grain of salt.
(Sidenote: add-apt-repository runs apt-get update automatically, but that's not documented in man add-apt-repository, only add-apt-repository --help. This was fixed in a later release.)
Tensorflow 2.2 now supports python 3.8 so problem is solved now.
I have found a way to do this with conda:
First, install conda in your Linux account:
wget https://repo.anaconda.com/archive/Anaconda3-2020.11-Linux-x86_64.sh
$ bash Anaconda3-2020.11-Linux-x86_64.sh
$ source ~/.bashrc
$ conda update --all
Then create a virtual environment with conda while specifying Python version:
$ conda create -n myenv python=3.7
$ conda activate hou-env
After that, running python -V in the command line will return Python 3.7.13
If you want to install python without sudo privileges, then just download a compressed version of python 3, decompress it, run.
Simple Answer : Ubuntu 19.04 and Ubuntu 19.10 come with Python 3.7 as default Python version.
Do you need it installed by default or just the ability to install it? Using the deadsnakes PPA is the defacto standard way of installing "other" Python versions on Ubuntu. To install Python 3.7, simply do sudo add-apt-repository ppa:deadsnakes/ppa && sudo apt update && apt install python3.7 on any currently supported Ubuntu release.
As others have pointed out, no currently supported version of Ubuntu has Python 3.7 out of the box.
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
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
pyenvinstaller - 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.