Cantech Knowledge Base

Your Go-To Hosting Resource

How to Install Python and Pip on Ubuntu 24.04?

Here’s the fastest way to install Python on Ubuntu 24.04. Ubuntu 24.04 LTS ships with Python 3.12 installed by default. To install Python and Pip, run:

sudo apt update
sudo apt install python3 python3-pip -y

Check versions with python3 --version and pip3 --version. To install a specific or newer version (e.g., 3.10 or 3.13), use the deadsnakes PPA – covered in the steps below.

Python is a versatile, high-level programming language that is prominently used for web development, data science, artificial intelligence, automation, because of its simple syntax and readability. Python is the default package manager for Python, used to install and manage libraries and dependencies not included in the Python standard library.

In this blog, we will go through the process of installing Python and Pip on Ubuntu 24.04 server and manage application processes on your server.

Prerequisites

  • Ensure your system’s package list is up-to-date to avoid potential conflicts.
  • Verify that your user account has administrative privileges to install software packages.
  • Check if Ubuntu 24.04 is installed since it comes with Python 3 pre-installed.

How Do I Install Python on Ubuntu 24.04?

Python exists within Ubuntu 24’s standard APT repositories, but may not be the latest version. Servers can host tailored application packages through Personal Package Archives (PPAs), which allows administrators to use the ppa:repository_name for installing both the latest and specific Python versions on their systems. Follow the subsequent steps to install the most recent Python version through PPA.

Step 1: Add the PPA to Server Sources

sudo add-apt-repository ppa:repository_name

Step 2: Update Package of Server Index

sudo apt update

Step 3: Install the Updated Python Version on the Server

sudo apt install python3

Step 4: Run the Below Command to Install a Particular Version Like 3.10.

sudo apt install python3.10

Step 5: Check the Installed Python Version on the Server

python3 --version

Example Output:

Python 3.12.3

How Do I Install Pip on Ubuntu 24.04?

Step 1: Run the Below Command to Install Pip

sudo apt install -y python3-pip

Step 2: Check the Installed Pip Version on the Server

pip3 --version

Example Output

pip 24.0 from /usr/lib/python3/dist-packages/pip (python 3.12)

How Do I Test My Python Installation?

Step 1: Access Python Using Below Command

python3

Step 2: Add the Below Code to Test Python Installation.

>>> print("Hello, Python!")

Output:

>>> exit()

Please refer to the Python documentation. for more information and usage options.

Conclusion

Installing Python and Pip on Ubuntu 24.04 is simple and quick. You can develop, manage packages and handle projects effectively with both tools. Managing dependencies in a virtual environment helps prevent some common issues during development.

Now that your setup is complete, you can start building projects and improving your programming skills with Python.

FAQs

What is the default Python version on Ubuntu 24.04?

Ubuntu 24.04 LTS ships with Python 3.12 pre-installed as the system default. You can confirm this by running python3 –version in the terminal.

How do I install a specific Python version like 3.10 on Ubuntu 24.04?

Add the deadsnakes PPA (sudo add-apt-repository ppa:deadsnakes/ppa), update your package index, then run sudo apt install python3.10. This lets you install versions not included in the default Ubuntu repository.

Can I install Python 2 on Ubuntu 24.04?

Python 2 is no longer maintained and isn’t available in the default Ubuntu 24.04 repositories. It can still be installed manually from source or via legacy PPAs, but it’s recommended only for compatibility with older scripts, not new development.

How do I install multiple Python versions on Ubuntu 24.04?

Install each version separately via APT or the deadsnakes PPA (e.g., python3.10, python3.12), then use update-alternatives to switch between them, or use pyenv for easier version management per project.

How do I upgrade pip to the latest version?

Run pip3 install –upgrade pip to update pip to the latest release, or python3 -m pip install –upgrade pip if you’re inside a virtual environment.

How do I uninstall Python or pip on Ubuntu 24.04?

Use sudo apt remove python3.x for a specific version, or sudo apt remove python3-pip to remove pip. Avoid removing the system default python3 package, as many Ubuntu tools depend on it.

Why do I get an “externally-managed-environment” error when using pip?

This is a safety feature in Ubuntu 24.04 (PEP 668) that blocks global pip installs to protect system packages. Use a virtual environment (python3 -m venv myenv) or add –break-system-packages only if you understand the risk.

August 18, 2026