How to Install Python 3.8 on Ubuntu, Debian and LinuxMint

Step 1 – Prerequsitis

As you are going to install Python 3.8 from the source. You need to install some development libraries to compile Python source code. Use the following command to install prerequisites for Python:

sudo apt-get install build-essential checkinstall
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev \
    libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev

Step 2 – Download Python 3.8

Download Python source code using the following command from python official site. You can also download the latest version in place of specified below.

cd /opt
sudo wget https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz

Then extract the downloaded source archive file

sudo tar xzf Python-3.8.0.tgz

Step 3 – Compile Python Source

Use below set of commands to compile Python source code on your system using altinstall.

cd Python-3.8.0
sudo ./configure --enable-optimizations
sudo make altinstall
make altinstall is used to prevent replacing the default python binary file /usr/bin/python.

Step 4 – Check Python Version

Check the installed version of python using the following command. As you have not overwritten the default Python version on the system, So you have to use Python 3.8 as follows:

python3.8 -V

Python-3.8.0

After successful installation remove the downloaded archive to save disk space

cd /opt
sudo rm -f Python-3.8.0.tgz
Was this answer helpful?

Related Articles

How to Enable CSF Firewall Web UI

Step 1 – Install Required Perl Modules: CSF UI required some of Perl modules to be installed...

How to Install and Configure CSF Firewall on Linux

Step 1: Download CSF Source Archive Download latest CSF archive source code from its official...

How To Install mod_cloudflare for Apache on Ubuntu

Install mod_cloudflare for Apache First of all, enable the PPA of Cloudflare module to your...

How To Install Wine 4.0 on CentOS 8 & Fedora 30/29

Step 1 – Prerequisite First of all, become root user on your CentOS 8 system. Then continue to...

How to Install Fail2Ban on CentOS 8 & Fedora 30/29

Step 1 – Install Fail2ban on CentOS 8 First of all, install epel-release package to configure...