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.
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.
Install Python on Ubuntu
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
Install Pip on Ubuntu
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)
Test Python
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.