How to install Python 3.8 on Ubuntu 18.04

Python is one of the most widely used programming languages in the world. The syntax is simple and easy to learn, and Python is a popular choice for beginners and those with work experience. Python is a versatile programming language. It can be used to build various applications, from simple scripts to complex machine learning algorithms.

Python 3.8 is the latest major release of the Python language. It contains many new features, including assignment expressions, positional-only parameters, f-strings support, etc.

Python 3.8 is not available in Ubuntu's default software source repository. In this guide, we will describe two different ways to install Python 3.8 on Ubuntu 18.04. The first option is to install the deb package from [deadsnakes PPA] (https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa).

The same steps are suitable for Ubuntu 16.04 and any distribution based on Ubuntu, including Kubuntu, Linux Mint, and Elementary OS.

1. Install Python 3.8 via Apt on Ubuntu

Installing Python 3.8 via Apt on Ubuntu is a straightforward way, and it only takes a few minutes:

  1. Run the following command as root or another user with sudo privileges to update the package list and install dependent packages:
sudo apt update
sudo apt install software-properties-common
  1. Add deadsnakes PPA to your system source list:
sudo add-apt-repository ppa:deadsnakes/ppa

When prompted, enter the Enter button to continue:

Press [ENTER] to continue or Ctrl-c to cancel adding it.
  1. Once the repositories are enabled, install Python 3.8:
sudo apt install python3.8
  1. To verify the success of the installation process, enter:
python3.8--version
Python 3.8.0

At this point, Python 3.8 has been installed on your Ubuntu system, and you can start using it.

2. Compile and install Python 3.8 from source code on Ubuntu

In this chapter, we will explain how to compile and install Python 3.8 through source code.

  1. Update the package list and install the necessary packages to compile Python:
sudo apt update
sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget
  1. From Python download page use wget to download the latest released software source code:
wget https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz

At the time of writing this article, the latest release is: 3.8.0

  1. When the download is complete, unzip the compressed package:
tar -xf Python-3.8.0.tgz
  1. Switch to the Python source code directory and execute the configure script. It will perform a series of checks and ensure that all dependencies are ready on your system:
cd Python-3.8.0./configure --enable-optimizations

- - The enable-optimizations option optimizes Python binary packages through multiple tests. This will slow down the compilation process.

  1. Start the compilation process of Python 3.8:
make -j 8

To shorten the compilation event, modify -j to fit your number of processors. You can find the number of processors by typing nproc.

  1. When the compilation is complete, install the Python binary package by typing the following command:
sudo make altinstall

Do not use the standard make install because it will overwrite the default system python 3 binary package.

  1. that's it. Python 3.8 has been installed and ready to use. Verify it with the following command:
python3.8--version

The output will show the Python version:

Python 3.8.0

Three, summary##

You have installed Python 3.8 on Ubuntu 18.04, and now you can start developing your Python 3 project.

Next, you can read about "How to Use Pip" and "How to Create Python Virtual Environments".

Recommended Posts

How to install Python 3.8 on Ubuntu 18.04
How to install Python2 on Ubuntu20.04 ubuntu/focal64
[Practice] How to install python3.6 on Ubuntu system
How to install Ruby on Ubuntu 20.04
How to install Java on Ubuntu 20.04
How to install VirtualBox on Ubuntu 20.04
How to install Elasticsearch on Ubuntu 20.04
How to install Protobuf 3 on Ubuntu
How to install Nginx on Ubuntu 20.04
How to install Apache on Ubuntu 20.04
How to install Git on Ubuntu 20.04
How to install Node.js on Ubuntu 16.04
How to install Vagrant on Ubuntu 20.04
How to install Bacula-Web on Ubuntu 14.04
How to install PostgreSQL on Ubuntu 16.04
How to install Git on Ubuntu 20.04
How to install Anaconda3 on Ubuntu 18.04
How to install Memcached on Ubuntu 18.04
How to install Jenkins on Ubuntu 16.04
How to install MemSQL on Ubuntu 14.04
How to install Go on Ubuntu 20.04
How to install MongoDB on Ubuntu 16.04
How to install Mailpile on Ubuntu 14.04
How to install PrestaShop on Ubuntu 16.04
How to install Skype on Ubuntu 20.04
How to install Jenkins on Ubuntu 20.04
How to install Python 3.8 on CentOS 8
How to install KVM on Ubuntu 18.04
How to install KVM on Ubuntu 20.04
How to install opencv3.0.0 on ubuntu14.04
How to install Anaconda on Ubuntu 20.04
How to install Prometheus on Ubuntu 16.04
How to install Jenkins on Ubuntu 18.04
How to install Apache on Ubuntu 20.04
How to install R on Ubuntu 20.04
How to install Python on CentOS 8
How to install Moodle on Ubuntu 16.04
How to install Solr 5.2.1 on Ubuntu 14.04
How to install Teamviewer on Ubuntu 16.04
How to install MariaDB on Ubuntu 20.04
How to install Nginx on Ubuntu 20.04
How to install Mono on Ubuntu 20.04
How to install Go on Ubuntu 20.04
How to install Zoom on Ubuntu 20.04
How to install Nginx on Ubuntu 16.04
How to install OpenCV on Ubuntu 20.04
How to install Spotify on Ubuntu 20.04
How to install Postman on Ubuntu 18.04
How to install Go 1.6 on Ubuntu 16.04
How to install Go on Ubuntu 18.04
How to install MySQL on Ubuntu 14.04
How to install PostgreSQL on Ubuntu 20.04
How to install VLC on Ubuntu 18.04
How to install TeamViewer on Ubuntu 20.04
How to install Webmin on Ubuntu 20.04
Install Python3 on Ubuntu 14.04
Install Python3 on Ubuntu 16.04
Install Python3.7 on Ubuntu
How to install Docker Compose on Ubuntu 18.04
How to install Ubuntu on Raspberry Pi
How to install Bacula Server on Ubuntu 14.04