Python is an object-oriented, high-level programming language. It is an open source with a large community. Python is used as key languages among the top tech companies like Google.

The Python 3.9 stable version has been released with several improvements and security updates. It included multiple new modules, improved existing modules and many other features.

You can choose deadsnakes PPA for Python installation on Ubuntu 20.04 system.

Use this tutorial to install Python 3.9 On Ubuntu 20.04 LTS Linux system via Apt-Get. You can also choose second method to install Python using source code.

Prerequisites

Login to your Ubuntu system and open a terminal, then install some required packages.

sudo apt update 
sudo apt install wget software-properties-common 

Installing Python 3.9 Using Apt

Use the Ubuntu package manager Apt to install Python 3.9 on Ubuntu Linux system. Follow the below steps:

  1. Open a terminal by pressing CTRL+ALT+T and then configure deadsnakes PPA to your system.
sudo add-apt-repository ppa:deadsnakes/ppa 
  1. Once your added the ppa on your Ubuntu system, update the apt cache and install Python 3.9 on Ubuntu.
sudo apt update 
sudo apt install python3.9 
  1. Wait for the installation to complete. Check the Python version by executing:
python3.9 -V 

Python 3.9.0

That’s it, You have successfully installed Python 3.9 on your Ubuntu 20.04 LTS system.

Installing Python 3.9 Using Source Code

You also have one more option option to install Python 3.9 using source code. We don’t recommend to install Python 3.9 packages from source code. But in some cases you may need to install Python from source code.

So follow the below instructions to install Python 3.9 using source code on Ubuntu 20.04 Linux system.

  1. First of all, install essential packages for compiling source code. Open a terminal and execute following commands:
sudo apt install build-essential checkinstall 
sudo apt install libreadline-gplv2-dev libncursesw5-dev libssl-dev \
    libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev 
  1. Now, download the Python 3.9 source code from official download site. Switch to a relevant directory and use wget to download source file.
cd /opt 
sudo wget https://www.python.org/ftp/python/3.9.0/Python-3.9.0.tgz 
  1. Next, extract the downloaded archive file and prepare the source for the installation.
tar xzf Python-3.9.0.tgz 
cd Python-3.9.0 
sudo ./configure --enable-optimizations 
  1. Python source is ready to install. Execute make altinstall command to install Python 3.9 on your system.

#python #python3.9

How To Install Python 3.9 on Ubuntu 20.04
10.85 GEEK