How to Update Python3 to the New Installed Version on Ubuntu 18.04

Abstract: Install newer Python 3 versions on Ubuntu 18.04 by adding the deadsnakes PPA and using apt to install specific releases alongside the default system version.

Created: 2026-09-10 by
To update Python 3 on Ubuntu 18.04, you must add the deadsnakes PPA because the default repositories only contain version 3.6. Use the commands sudo add-apt-repository ppa:deadsnakes/ppa, sudo apt update, and sudo apt install python3.X (replacing X with your desired version) to install the new binaries alongside the system default.

Why Default Repositories Are Insufficient

Ubuntu 18.04 LTS was released with Python 3.6 as its standard interpreter in the official main repository. While this version is stable and sufficient for many legacy applications, modern development often requires newer features found in Python 3.7, 3.8, or later. The Ubuntu package maintainers prioritize stability over cutting-edge software, meaning they do not frequently backport newer Python versions to older LTS releases like Bionic Beaver.

If you attempt to upgrade Python using only the standard apt commands without adding external sources, your system will likely report that the latest available version is already installed. This does not mean you have the newest Python; it simply means you are stuck at the version provided by Canonical for that specific release cycle. To access newer interpreters, you need a third-party repository known as a Personal Package Archive (PPA).

Adding the Deadsnakes PPA

The most reliable source for newer Python versions on Ubuntu is the deadsnakes PPA. This community-maintained repository provides packages for various Python versions that are not included in the official Ubuntu archives. Before adding this repository, ensure your system has the necessary tools to manage PPAs.

  1. Install Software Properties Common: If you do not already have the software-properties-common package installed, you must install it to use the add-apt-repository command.
sudo apt install software-properties-common
  1. Add the Repository: Run the following command to add the deadsnakes PPA to your system's software sources.
sudo add-apt-repository ppa:deadsnakes/ppa

When prompted, press Enter to confirm the addition of the repository. This step updates your local package index to include the new sources. Note that if you encounter issues similar to those described in Fixing PPA Purge Errors in Ubuntu, ensure your GPG keys are correctly configured to avoid authentication failures during the update phase.

Installing the Desired Python Version

Once the repository is added, you can search for and install the specific version of Python 3 you require. It is important to understand that installing a new version via APT will not replace the existing system Python. Instead, it installs the new version alongside the old one. This approach prevents breaking system utilities that depend on the original Python 3.6 binary.

  1. Update Package Index: Refresh your package list to fetch information about the new packages available from the deadsnakes PPA.
sudo apt update
  1. Install Python: Replace X with the minor version number you want (e.g., 3.8, 3.9, 3.10).
sudo apt install python3.X

For example, to install Python 3.9, you would run sudo apt install python3.9. This command installs the interpreter, the standard library, and the venv module. You may also wish to install python3.X-dev if you plan to compile C extensions for this specific version.

Managing Multiple Python Versions

After installation, you will have multiple Python versions on your system. By default, the python3 command still points to the original system version (3.6). To use the newly installed version, you must invoke it explicitly by its version number, such as python3.9.

If you prefer to make the new version the default when typing python3, you can use the update-alternatives tool. This utility allows you to set symbolic links for different commands. However, modifying the system default is generally discouraged unless you are certain no other system scripts rely on the original version.

sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 2

In this example, the higher priority number (2) makes Python 3.9 the default. You can switch between them interactively using sudo update-alternatives --config python3. For most developers, creating virtual environments using the specific version binary is the safest and most flexible workflow.

Verifying the Installation

Confirm that the new version is correctly installed by checking its version string. This step ensures that the package manager successfully downloaded and configured the interpreter.

python3.X --version

You should see output matching the version you requested. If you encounter dependency errors, refer to guides on Solving Ubuntu Unmet Dependencies Error to resolve conflicts with existing libraries. Keeping your Python environment updated ensures compatibility with modern frameworks and security patches.

Frequently Asked Questions

Will updating Python break my system?

No, installing a new Python version via the deadsnakes PPA does not remove or overwrite the system default Python. It installs the new version in parallel, ensuring that critical OS utilities relying on Python 3.6 continue to function correctly.

How do I uninstall a Python version installed from a PPA?

You can remove the specific package using sudo apt remove python3.X. After removal, you may also want to clean up unused dependencies with sudo apt autoremove to free up disk space.

Can I use pip with the new Python version?

Yes, each installed Python version comes with its own pip installer. You should use pip3.X or python3.X -m pip to install packages for that specific interpreter, preventing package conflicts between different Python environments.

Is it safe to change the default python3 symlink?

While technically possible, changing the default symlink is risky. Many Ubuntu system tools depend on the specific behavior of the original Python 3.6. It is safer to use explicit version calls or virtual environments rather than altering the global default.

What if I cannot add the PPA due to network restrictions?

If you cannot access external PPAs, you might consider compiling Python from source. However, this is complex and error-prone. Alternatively, check if your corporate proxy allows HTTPS traffic to the deadsnakes repository, or look into containerized solutions like Docker which isolate Python versions from the host OS.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More