Cantech Knowledge Base

Your Go-To Hosting Resource

How to Install Python and Pip on Ubuntu 24.04?

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.

Pre-requisites

  • 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.

Python Installation

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.

Add the PPA to server sources

sudo add-apt-repository ppa:repository_name

Update package of server index

sudo apt update

Install the updated Python version on the server.

sudo apt install python3

Run the below command to install a particular version like 3.10.

sudo apt install python3.10

Now, check the installed Python version on the server.

python3 --version

Example Output:

Python 3.12.3

Pip Installation

Run the below command to install Pip.

sudo apt install -y python3-pip

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)

Testing Python

Access Python using below command

python3

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.

March 24, 2025