If you’re looking to Install Python 3.9 on Ubuntu 20.04, there are two reliable methods available. You can either use a trusted package repository for a quick installation or compile Python from source to gain access to the latest features and customization options.
Python remains one of the most widely used programming languages for web development, automation, artificial intelligence, data science, and system administration. Python 3.9 introduced several improvements, including enhanced dictionary operations, new string methods, and better time zone support, making it a popular choice among developers.
In this guide, you’ll learn how to install Python 3.9 on Ubuntu 20.04 using both methods.
Ubuntu 20.04 ships with an older Python version by default. While it works well for many applications, developers often need newer Python releases to access updated features, improved performance, and better compatibility with modern frameworks.
Installing Python 3.9 alongside the system version allows you to use the latest capabilities without affecting critical Ubuntu components.
The easiest way to install Python 3.9 is through a trusted third-party repository that provides updated Python packages for Ubuntu.
First, update your package list and install the required tools:
sudo apt updatesudo apt install software-properties-common
Next, add the repository that contains Python 3.9 packages:
sudo add-apt-repository ppa:deadsnakes/ppa
After enabling the repository, install Python 3.9:
sudo apt updatesudo apt install python3.9
Verify the installation:
python3.9 --version
If everything is successful, Ubuntu will display the installed Python version.
Developers who want maximum control over their Python installation can build it directly from source code.
Start by installing the necessary build dependencies:
sudo apt updatesudo apt install build-essential zlib1g-dev libncurses5-dev \libgdbm-dev libnss3-dev libssl-dev libreadline-dev \libffi-dev libsqlite3-dev wget libbz2-dev
Download the Python source archive and extract it:
wget https://www.python.org/ftp/python/3.9.1/Python-3.9.1.tgztar -xf Python-3.9.1.tgz
Move into the extracted directory:
cd Python-3.9.1
Configure the build process:
./configure --enable-optimizations
Compile Python:
make -j $(nproc)
Finally, install it without replacing Ubuntu’s default Python version:
sudo make altinstall
Confirm the installation:
python3.9 --version
After you install Python 3.9, it’s a good idea to ensure the interpreter is functioning correctly.
Run:
python3.9
You should enter the Python interactive shell, where you can execute commands and test functionality immediately.
For development projects, consider creating isolated virtual environments to manage dependencies efficiently and avoid package conflicts.
Choosing to Install Python 3.9 on Ubuntu 20.04 gives developers access to modern language features, improved performance, and broader compatibility with current applications. Whether you use the faster repository-based method or compile from source for greater flexibility, both approaches provide a dependable way to Install Python 3.9 while keeping your Ubuntu system stable and secure.
phpMyAdmin is a free, open-source PHP application that provides a browser-based interface for managing MySQL and…
Zabbix is a mature open-source infrastructure monitoring platform that collects metrics from network devices, servers, virtual…
Gradle is a powerful open-source build automation tool used primarily for Java, Kotlin, Groovy, and Android…
TeamViewer is a proprietary cross-platform remote access application for remote control, desktop sharing, file transfer, and online meetings. It is one of the most widely used remote support tools in the world, available for Windows, macOS, Linux, iOS, and Android. TeamViewer is not included in the Ubuntu repositories because it is proprietary software. This guide covers how to install TeamViewer on Ubuntu 18.04 using the official .deb package. The same steps apply to Ubuntu 16.04, Debian, Linux Mint, and Elementary OS. <strong>Prerequisite:</strong> You need sudo access. Install TeamViewer on Ubuntu: Download the .deb Package Download the official TeamViewer .deb package. The _amd64.deb suffix indicates this package is for 64-bit x86-64 systems. For ARM-based machines, download the appropriate package from the TeamViewer Linux downloads page: bashwget https://download.teamviewer.com/download/linux/teamviewer_amd64.deb Install the package using apt. The ./ prefix tells apt this is a local file path, not a package name from the repositories:…
Nagios is one of the most widely used open-source infrastructure monitoring systems in the world. It…
Laravel is an open-source PHP web application framework built around an expressive, developer-friendly syntax. It is…