This brief tutorial shows how to install and configure Python 3.8 on Ubuntu.
There are 2 methods to install python on Ubuntu. I prefer first method and
strongly recommend that but it depends on developer's taste.
Method 1: Install It From Source Code
I prefer this method since I'd rather always go to source, whether it is
documentation for an API or installing something.
Out of the box default python version for Ubuntu 18.{04/10} is python 3.6
and for Ubuntu 19.{04,10} is Python 3.7
. As now, Python 3.8.1
is the lastest stable version released on Dec 18, 2019. If you find a later version on the site, you can download it instead.
You can find all released python versions in this link: Python Versions
In order to install from source code we need to download the installer file and run the executable.
Before installing python, you must first install some required packages that are needed to build python from source. Maybe you have already installed them. However to get these packages installed, run the commands below:
$ sudo apt update
$ sudo apt upgrade
$ sudo apt dist-upgrade
$ sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget
Now create a temporary directory and download the python source code:
$ mkdir ~/tmp
$ cd ~/tmp
$ wget https://www.python.org/ftp/python/3.8.1/Python-3.8.1.tgz
After downloading the package, run the commands below to extract the file and configure the python:
$ tar -xvzf Python-3.8.1.tgz
$ cd Python-3.8.1
$ ./configure
To install the python:
$ sudo make altinstall
Do not use the standard make install
as it will overwrite the system's default python3 binary
β/usr/bin/python3
. Since it will probably make a mess of your OS. However it is your choice again.
After make altinstall
, python should be installed and ready to use.
To test if python is installed and ready to use, run the commands below
$ python3.8 --version
You should see an output similar to the one below:
Python 3.8.1
Method 2: Installing Python via PPA
If you want to get the latest version of Python quckly installed and get future updates automatically, you can install it from the below third-party PPA repository.
First install Ubuntu software properties package if itβs not already installed on your system.
$ sudo apt update
$ sudo apt install software-properties-common
After that run the commands to add the PPA.
$ sudo add-apt-repository ppa:deadsnakes/ppa
Finally, run below to install Python 3.8
$ sudo apt update
$ sudo apt install python3.8
You can check as below:
$ python3.8 --version
Python 3.8.1
OK, All done!
Top comments (1)
Hey,
Do you have steps to install python 3.8 version in Ubuntu 14.04??
i tried all the ways but couldn't able to install it...
let me know if you have steps for same.
Regards
R