Home » How To » How To Install PIP on Linux

How To Install PIP on Linux

PIP is a popular package management tool for Python. It allows the Python developers to install and manage additional Python libraries in their applications. PIP stands for Preferred Installer Program.

Rather than a package management utility, PIP can create a completely isolated environment for the Python application. In this tutorial, you will learn about the installation of PIP on the Debian Linux system.

Prerequisites

This tutorial assumes that you already have installed Python 3 on your system. Next login to the Linux system with sudo privileged account access.

Installing PIP for Python 3

You need to install separate PIP versions for Python3 and Python2. As you already have Python3 installed your system. Open a terminal with a sudo privileged account and run the below command to install PIP for Python3 on Debian Linux system.

The following command will install PIP3 for Python3:

sudo apt update  sudo apt install python3-pip 

Once the installation is completed successfully, check the PIP3 version by executing:

pip3 -V 

Output:

PIP 20.3.4 from /usr/lib/python3/dist-packages/PIP (python 3.9)

You may see a different PIP3 version on your system. Now, PIP3 is ready to use on your system.

Related:  How to Use SCP Command to Securely Transfer Files

Installing PIP for Python 2

Python 2 is reached to end of life and is no more maintained. Also, it is not installed default on Debian 11 Linux. We suggest using Python 3 for your new applications.

But if your existing application still requires Python 2, then you can install it from default repositories. To install Python2.7 packages type:

sudo apt install python2 

Now, install PIP for Python 2. Use the following command to download the PIP2 installer on your system.

curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o /tmp/get-pip.py 

Then run the downloaded Python script with python2 binary.

sudo python2 /tmp/get-pip.py 

The above command will install and configure PIP for Python2 on your system. To verify the installation and check the installed PIP2 version, type:

pip -V 

Output:

PIP 20.3.4 from /usr/local/lib/python2.7/dist-packages/PIP (python 2.7)

So now we have PIP installed on our Linux system.

Leave a Comment