How To Install Python 3 8 On Linux – Python Version Manager Usage

Python 3.8 requires adding the deadsnakes PPA on Ubuntu-based distributions. If you’re wondering how to install python 3 8 on linux, you’ve come to the right place. This guide walks you through the process step by step, covering multiple Linux distributions like Ubuntu, Debian, Fedora, and CentOS. By the end, you’ll have Python 3.8 up and running on your system, ready for your projects.

Python 3.8 was a major release with features like assignment expressions (the walrus operator) and positional-only parameters. While newer versions exist, many legacy applications and specific libraries still depend on Python 3.8. Installing it on Linux is straightforward, but the method varies depending on your distribution. Let’s break it down.

How To Install Python 3 8 On Linux

Before we start, check if Python 3.8 is already installed on your system. Open a terminal and type:

python3.8 --version

If you see a version number, you’re good to go. If not, follow the instructions below for your specific Linux distribution. We’ll cover the most common ones: Ubuntu/Debian, Fedora/CentOS/RHEL, and Arch Linux.

Prerequisites For Installing Python 3.8

You’ll need a few things before starting:

  • A Linux system with internet access
  • Sudo or root privileges
  • Basic familiarity with the terminal
  • Package manager tools (apt, dnf, yum, or pacman)

Make sure your system is updated. Run the following commands for Ubuntu/Debian:

sudo apt update
sudo apt upgrade -y

For Fedora/CentOS, use:

sudo dnf update

Now, let’s dive into the installation methods.

Method 1: Installing Python 3.8 On Ubuntu And Debian

Ubuntu and Debian users can install Python 3.8 from the deadsnakes PPA. This PPA provides older Python versions that aren’t in the official repositories. Here’s how:

  1. Add the deadsnakes PPA:
sudo add-apt-repository ppa:deadsnakes/ppa

Press Enter when prompted to confirm.

  1. Update your package list:
sudo apt update
  1. Install Python 3.8:
sudo apt install python3.8
  1. Verify the installation:
python3.8 --version

You should see output like Python 3.8.10. If you get an error, check that the PPA was added correctly.

Optionally, install python3.8-venv for virtual environments and python3.8-dev for development headers:

sudo apt install python3.8-venv python3.8-dev

That’s it for Ubuntu and Debian. The deadsnakes PPA is maintained by the community and is generally safe to use.

Method 2: Installing Python 3.8 On Fedora, CentOS, And RHEL

For Fedora and CentOS/RHEL, Python 3.8 is available from the EPEL (Extra Packages for Enterprise Linux) repository or the default repositories. Here’s the process:

On Fedora

  1. Enable the EPEL repository (if needed):
sudo dnf install epel-release
  1. Install Python 3.8:
sudo dnf install python38
  1. Verify:
python3.8 --version

Fedora usually includes Python 3.8 in its default repos, so you might not need EPEL. If the command fails, try:

sudo dnf search python3.8

Then install the appropriate package.

On CentOS 7 And RHEL 7

CentOS 7 and RHEL 7 require the SCL (Software Collections) repository for Python 3.8. Here’s how:

  1. Enable the SCL repository:
sudo yum install centos-release-scl
  1. Install Python 3.8:
sudo yum install rh-python38
  1. Enable Python 3.8 for your session:
scl enable rh-python38 bash
  1. Verify:
python3.8 --version

Note that SCL installations don’t replace the system Python. You need to enable the collection each time you want to use Python 3.8. To make it permanent, add the scl enable command to your .bashrc file.

On CentOS 8 And RHEL 8

CentOS 8 and RHEL 8 have Python 3.8 in the AppStream repository. Install it with:

sudo dnf install python38

Verify with python3.8 --version. This should work out of the box.

Method 3: Installing Python 3.8 On Arch Linux

Arch Linux users can install Python 3.8 from the AUR (Arch User Repository). Use an AUR helper like yay or paru. Here’s the process:

  1. Install an AUR helper (if you don’t have one):
sudo pacman -S --needed git base-devel
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si
  1. Install Python 3.8 from the AUR:
yay -S python38
  1. Verify:
python3.8 --version

Alternatively, you can compile Python 3.8 from source (see Method 4). The AUR method is faster and easier.

Method 4: Compiling Python 3.8 From Source

If your distribution doesn’t have Python 3.8 in its repositories, or you need a custom build, compiling from source is a reliable option. This works on any Linux distribution. Here’s how:

  1. Install build dependencies:

For Ubuntu/Debian:

sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget

For Fedora/CentOS:

sudo dnf groupinstall "Development Tools"
sudo dnf install openssl-devel bzip2-devel libffi-devel
  1. Download the Python 3.8 source code:
cd /tmp
wget https://www.python.org/ftp/python/3.8.16/Python-3.8.16.tgz

Replace 3.8.16 with the latest Python 3.8 version (check python.org for updates).

  1. Extract the archive:
tar -xf Python-3.8.16.tgz
cd Python-3.8.16
  1. Configure the build:
./configure --enable-optimizations

The --enable-optimizations flag enables profile-guided optimization, which makes Python faster. This step takes longer.

  1. Compile Python:
make -j $(nproc)

The -j $(nproc) flag uses all CPU cores to speed up compilation.

  1. Install Python:
sudo make altinstall

Using altinstall instead of install prevents overwriting the system’s default Python binary. This creates python3.8 and pip3.8.

  1. Verify:
python3.8 --version

You should see Python 3.8.16. If you get a “command not found” error, check that /usr/local/bin is in your PATH.

Compiling from source gives you full control, but it takes longer. It’s a good option for advanced users or when package managers fail.

Setting Up Python 3.8 As The Default Python

After installing Python 3.8, you might want to set it as the default Python version. Be careful: changing the system Python can break OS tools that rely on a specific version. Instead, use alternatives like update-alternatives on Debian-based systems or create an alias.

Using Update-Alternatives (Debian/Ubuntu)

  1. Register Python 3.8:
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1
  1. Set Python 3.8 as the default:
sudo update-alternatives --config python

Select the number corresponding to Python 3.8. Now python --version should show Python 3.8.

Creating An Alias

Add this line to your ~/.bashrc or ~/.bash_aliases:

alias python='python3.8'

Then run source ~/.bashrc. This only affects your user session.

Installing Pip For Python 3.8

Pip is the package installer for Python. Most installation methods include pip automatically. To verify, run:

python3.8 -m pip --version

If pip isn’t installed, install it with:

sudo apt install python3.8-pip   # Debian/Ubuntu
sudo dnf install python38-pip    # Fedora
sudo yum install python38-pip    # CentOS

Or use the get-pip.py script:

wget https://bootstrap.pypa.io/get-pip.py
python3.8 get-pip.py

Now you can install Python packages with python3.8 -m pip install package_name.

Creating Virtual Environments With Python 3.8

Virtual environments keep project dependencies isolated. Python 3.8 includes the venv module. Create a virtual environment like this:

python3.8 -m venv myproject_env

Activate it:

source myproject_env/bin/activate

Your prompt will change to show the environment name. Install packages inside it without affecting the system Python. Deactivate with:

deactivate

This is a best practice for Python development.

Troubleshooting Common Issues

Even with clear steps, you might run into problems. Here are common issues and fixes:

  • PPA not found: On older Ubuntu versions, the deadsnakes PPA might not be supported. Upgrade your system or use the source compilation method.
  • SSL module missing: When compiling from source, ensure you have OpenSSL development headers installed. Reconfigure and recompile.
  • Permission denied: Use sudo for system-wide installations. For user-specific installations, use --user with pip.
  • Command not found: Check your PATH variable. Python 3.8 is often installed in /usr/local/bin or /usr/bin.
  • Dependency errors: On CentOS 7, SCL collections might conflict with system packages. Use scl enable correctly.

If you’re still stuck, search for the specific error message online. The Python community is very helpful.

Uninstalling Python 3.8

If you no longer need Python 3.8, uninstall it safely. For package manager installations:

  • Ubuntu/Debian: sudo apt remove python3.8
  • Fedora: sudo dnf remove python38
  • CentOS 7: sudo yum remove rh-python38
  • Arch: yay -R python38

For source installations, remove the files manually:

sudo rm -rf /usr/local/bin/python3.8
sudo rm -rf /usr/local/lib/python3.8

Be careful not to remove system Python files.

Why Use Python 3.8 In 2025?

Python 3.8 is no longer the latest version, but it’s still widely used. Many enterprise applications, scientific libraries, and legacy systems depend on it. If you’re working with older codebases or specific frameworks like Django 3.x, Python 3.8 is the right choice. It’s also stable and well-documented.

However, for new projects, consider using Python 3.11 or 3.12 for better performance and features. Python 3.8 is end-of-life since October 2024, meaning it no longer receives security updates. Use it only when necessary.

Frequently Asked Questions

Can I install Python 3.8 on Linux without sudo?

Yes, you can compile Python 3.8 from source and install it in your home directory using ./configure --prefix=$HOME/.local. Then add $HOME/.local/bin to your PATH.

How do I install Python 3.8 on Linux Mint?

Linux Mint is based on Ubuntu, so the deadsnakes PPA method works. Follow the Ubuntu instructions above. Mint 20 and later support this.

What is the difference between python3 and python3.8?

python3 usually points to the system’s default Python 3 version (e.g., 3.10 or 3.12). python3.8 specifically calls Python 3.8. Use the latter for projects that require this version.

How to install Python 3.8 on Linux without internet?

Download the Python 3.8 source tarball on a machine with internet, transfer it via USB, then compile it offline. Ensure all build dependencies are installed beforehand.

Is Python 3.8 safe to use in 2025?

Python 3.8 is end-of-life and no longer receives security patches. For production systems, upgrade to a supported version. For testing or legacy projects, it’s acceptable but risky.

Final Thoughts