How to install pip on Ubuntu – Python Package Manager

pip is a free and open source Python package manager for Linux, macOS, Windows and Unix. Using pip you can easily install and manage python packages from Python Package Index (PyPI) online repository or any other indexes on your system. It is released under MIT license. In this tutorial i am going to install pip python package manager for Python 3 and Python 2.

Note: Python 2 officially in end-of-life and Python 2.7.18 is the last stable release of Python 2, released on April 20, 2020. Python 2 is not installed by default on Ubuntu 20.04. So Python users please switch to Python 3.

Install pip Python Package Manager on Ubuntu:

You don’t need to install Python 3 on ubuntu, it comes as per-installed with Ubuntu. You can check the installed python 3 version by below in terminal.

python3 --version

Install pip for Python 3:

Open your terminal app (ctrl+alt+t) and run this command to update your ubuntu source list.

sudo apt update

Enter your Ubuntu password. Then this pip installation command.

sudo apt install python3-pip

Then verify your pip installation with this command.

pip3 --version

Install pip for Python 2:

First check if python 2 comes with your system with this command.

python --version

If you get “Command ‘python’ not found“, then you need to install python 2 first. Enable the ubuntu universe repository. You can enable via below command also.

sudo add-apt-repository universe

Then enter the below command in terminal and install python 2.

sudo apt install python2

Then install curl on your system if you don’t have.

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 will also install setuptools and wheel. check the installed version by

pip --version

PIP Usage:

pip3 --help

Example:

Also Read:  How to Check Ubuntu Version in Terminal

Install python package via pip

sudo pip3 install PACKAGENAME

Uninstall python package via pip

sudo pip3 uninstall PACKAGENAME

That’s all.

If you liked this article, please subscribe to our YouTube Channel. You can also stay connected with us on X (Twitter) and Facebook.



This Post Has 10 Comments

Leave a Reply