Pip is a popular package management tool for Python. It allows the Python developers to install and manage additional Python libraries in their applications. This is a similar application to nvm for Node.js and composer for PHP. 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 11 Linux system.

Prerequisites

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

Users have fresh installed Debian 11, can follow the initial server setup instructions.

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 11 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.

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 installed Pip2 version, type:

pip -V 

Output:

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

Conclusion

This tutorial helps you to install Pip for Python3 on Debian 11 Linux. Additionally provided the instructions for installing Pip for Python2. You can follow these instructions to create an isolated environment.