How to Install Python Pip on Ubuntu 22.04 LTS
Pip is the standard package-management system that is used to install and manage software packages written in Python. In short, Pip is the package installer for Python. From Ubuntu 20.04, Python 3 is included in the base system installation but you still have the option of installing Python 2 from the universe repository.
How To Install Python Pip On Ubuntu 22.04 LTS
1. Install pip for Python 3 on Ubuntu 22.04
If you want to install pip for Python 3 on Ubuntu 22.04 then you need to run the following commands in your terminal. You should have the administrative (sudo) privilege to install Pip.
Run this command to update your system and repositories.
sudo apt update
Run this command to install Python3 Pip on Ubuntu 22.04 LTS.
sudo apt install python3-pip
Wait for a while as the installation will complete. After completing the installation process, run the command below to verify the installation by checking the pip version:
pip3 --version
1. Install pip for Python 2 on Ubuntu 22.04
Pip for Python 2 is not included in the Ubuntu 22.04 repositories by default. We need to install it from the universe repository. You need to enable the universe repository.
sudo add-apt-repository universe
Now, after enabling the universe repository, you need to update your system.
sudo apt update
Now, Open your terminal and run the following command to install Python2 on Ubuntu 22.04 LTS.
sudo apt install python2
After installing Python2, download the get-pip.py
script with the following command using curl:
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py
Now, it’s time to install Python2 pip on Ubuntu 22.04 LTS.
sudo python2 get-pip.py
Verify the Python2 pip installation on Ubuntu 22.04 LTS by running the following command.
pip2 --version
How To Install Packages With Pip On Ubuntu
You can easily download and install packages with Pip on Ubuntu 22.04 LTS. It’s pretty simple.
pip3 install package-name
Run the following command to list the packages installed with Pip in your Ubuntu.
pip3 list