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.
Installing Python 3.8 via Apt on Ubuntu is a straightforward way, and it only takes a few minutes:
sudo apt update
sudo apt install software-properties-common
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.
sudo apt install python3.8
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.
In this chapter, we will explain how to compile and install Python 3.8 through source code.
sudo apt update
sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget
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
tar -xf Python-3.8.0.tgz
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.
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
.
sudo make altinstall
Do not use the standard make install
because it will overwrite the default system python 3 binary package.
python3.8--version
The output will show the Python version:
Python 3.8.0
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