pip is a free and open source Python package manager for Linux, macOS, Windows and Unix. With pip, you can easily install and manage Python packages from the Python Package Index (PyPI) online repository or any other index on your system. It is released under the MIT license. In this tutorial, you will install the pip python package manager for Python 3 and Python 2.
Note: Python 2 is officially discontinued and Python 2.7.18 is the last stable release of Python 2 released on April 20, 2020. Python2 is not installed by default on Ubuntu 20.04. Therefore, Python users should switch to Python 3.
Install pip Python Package Manager on Ubuntu.
You don’t need to have Python 3 installed on Ubuntu 3. It is provided installed with Ubuntu. You can check the installed version of python 3 in the following terminal.
Install pip for Python 3.
Open the terminal app (ctrl + alt + t) and run this command to update the ubuntu source list.
sudo apt update
Enter the Ubuntu password. Then this pip install command.
sudo apt install python3-pip
Then use this command to confirm the pip installation.
Install pip for Python 2.
First, use this command to check if your system ships with Python 2.
If you get “Command “python” not found“Next, you need to first install python 2. Enable the ubuntu universe repository. You can also enable it with the following command.
sudo add-apt-repository universe
Next, enter the following command in the terminal to install python 2.
sudo apt install python2
If not, install curl on your system.
sudo apt install curl
Then download the pip installer script.
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
Then run this command to install pip for python 2.
sudo python2 get-pip.py
It also installs setuptools and wheels. Check installed version
Use of PIP:
Recommended Reading: How to Install Shortwave on Ubuntu-Internet Radio Player
Install Python package via pip
sudo pip3 install PACKAGENAME
Uninstall Python package via pip
sudo pip3 uninstall PACKAGENAME