How to Install Python Pip on Ubuntu

How to Install Python Pip on Ubuntu

Pip is the recommended package installer for python, with which you can install any python library or package that is present in the Python Package Index (and other indexes).

Pip is a command-line tool that is cross-platform, featuring easy-to-use commands to manage your python packages. Like Python, pip has two versions, Pip 3 for Python 3 and Pip 2 for Python 2.

This article explains how to install both of them in Ubuntu 20.04 (the guide works for other releases of Ubuntu and most Debian-based distros).

How to install Pip 3 on Ubuntu

Installing Pip 3 is straightforward, you have to execute just two commands to install it. Obviously, you have to have Python 3 installed, but luckily it is pre-installed on Ubuntu 20.04.

Let’s update apt package list to insure we get the latest software version by executing the next command:

sudo apt update

Now execute the next command to install Pip 3.

sudo apt install -y python3-pip

How to use Pip 3

Pip commands work in every system having pip installed. Though, the most useful pip commands are:

To install a package, we can use this command. Here I will install numpy:

pip3 install <pack_name>

or you can run this command:

python3 -m pip install <pack_name>

word image 51 e1652544542120

Note: the last commands will install the package for just the user who executed it. If you want to install the libraries globally, run one of the previous commands as root:

sudo pip3 install <pack_name>

word image 52 e1652544575719

Uninstall Package with Pip 3

To remove a package (same goes for the root command):

pip3 uninstall <pack_name>

Upgrade Package with Pip 3

To upgrade a package:

pip3 install --upgrade <pack_name>

To get information about a package.

word image 53 e1652544648936

Show Package Details with Pip 3

pip3 show <pack_name>

Show Pip 3 Version

pip3 --version

Show Pip Information

pip3 show pip

word image 54 e1652544695555

There are other commands, so you can always go to the help manual within the package or check the man page of Pip 3, or even go to the online python documentation page.

pip3 -h
man pip3

word image 55 e1652544726591

How to install Pip 2 on Ubuntu

Because of EOL (End Of Life) of Python 2 as of January 2020, it’s not already installed on Ubuntu, so you need to install it before installing Pip 2 (you can omit the second step if you have Python 2 installed).

Update apt package list by running next command:

sudo apt update

Install Python 2 by executing the following:

sudo apt install -y python2

Now we can install Pip 2.

Download Pip 2 using the command bellow:


Execute the next command (if you want to install Pip 2 globally execute as root):


How to use Pip 2

Pip 2 isn’t supported as a standalone tool, but still you can use Pip 2 as a part of Python 2.

To install a package:

python2 -m pip install <pack_name>

To remove a package:

python2 -m pip uninstall <pack_name>

To upgrade a package:

python2 -m pip install --upgrade <pack_name>

To check the version of a package.

python2 -m pip show <pack_name>

To show pip version, or as above, show all information:

python2 -m pip --version
python2 -m pip show pip

word image 56 e1652544762213


In this article, we learned how we can install pip for both Python 3 and Python 2, as well as some useful commands to manage your python packages.

Notify of
Receive notifications when your comment receives a reply. (Optional)
Your username will link to your website. (Optional)
Inline Feedbacks
View all comments
You May Also Like