The short form of “pip” python installer package. This package is used for the installation and removal of Python packages in your Linux/Ubuntu operating system. The developer uses the pip to share and engage with code. It also helps in a way, that not to worry about the package management but focus on the code. This article gives an overview to install the pip package on your Linux/Ubuntu operating system.
How to Install Pip Ubuntu 22.04
There are two versions of Python “Python2” and “Python3” therefore install both versions on the Ubuntu/Linux operating system from the terminal.
- Installation of Pip python 3
- Installation of Pip python 2
Installation of Pip python 3
Step 1: To install python3 open the terminal by shortcut “Ctrl+Shift+T” from the keyboard and execute the below command.
sudo apt update
In the above command
- “sdo” command is used to attain the root rights in the Linux terminal.
- “apt”u command is used to access the advanced packages to install and remove files in the Linux terminal.
- “update” command updates the core libraries.
Step 2: To install the Python3-pip the command to be executed is given below.
sudo apt install python3-pip -y
In the above command “install” is used to install the “python3-pip” on your Linux/Ubuntu operating system.
Step 3: The installation of Python3 is confirmed by executing the below-given command.
pip3 --version
To check the list of all the packages installed by the above command the command to be run in the terminal is given as.
pip3 list
To uninstall the single package from all the installed packaged the command to be executed is given as
pip3 uninstall package name
To get more information about the pip3 package the command to be executed is given as
pip3 --help
Installation of pip Python 2
Step 1: Now for the installation of Python2 the first step is to update the core libraries by executing the below given command.
sudo apt update
Before installation of Python2 the universe repository is to enable by executing the below given command.
sudo add-apt-repository universe
Step 2: Now install the python2 by executing the below-given command.
sudo apt install python2
In the above command “install” is used to install “Python2” on your Linux/Ubuntu operating system.
To continue your installation type “y” from the keyboard and press enter.
Step 3: The “curl” command is the data exchange tool between the operating system and server by using the Linux terminal. The pip is to be installed for Python2 by using the curl package. Therefore download the curl package by executing the below-given command.
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py
To install the curl package execute the below given command.
sudo apt install curl -y
Step 4: To install the Python2-pip run the below given command in the Linux/Ubuntu terminal.
sudo python2 get-pip.py
Step 5: Now check the installed version of Python2-pip by running the below-given command in the terminal.
pip2 --version
Uninstallation of Python3-pip
To uninstall the Python3-pip the command to be executed in the Linux terminal is given as
sudo apt autoremove python3-pip
In the above command “autoremove” is used to uninstall the “python3-pip”.
Uninstallation of Python2-pip
To uninstall the Python2-pip the command to be executed in the Linux terminal is given as
sudo python2 -m pip uninstall pip
In the above command “-m pip uninstall” is used to uninstall the pip for “python2”.
Conclusion
There are two versions of Python such as Python2 and Python3 for the installation of both, you update your core libraries by executing the “sudo apt update”. For the installation of Python3, the command to execute is “sudo apt install python3-pip -y”. The confirmation of installation of Python3-pip is verified by the “pip3 — version” command. Now for installing Python2-pip, the command to be executed is “sudo python2 get-pip.y”, and the installation verification is done by executing the “pip3 — version” command.