Newsletter Subscribe
Enter your email address below and subscribe to our newsletter
Python is one of the most popular programming languages, and Pip is a package manager written in Python. If you don’t have much idea about Pip, you can think of Apt that we use to download packages but it’s used to download packages for Python-based packages.
We will be covering how you can install Pip in Debian 11/10 but this is also applicable to other Debian-based Linux distros such as Ubuntu, Pop_OS, Linux Mint, and many others. but before that let’s get out basics straight on Pip.
Table of Contents
Pip stands for Pip Installs Python. Pip is used for installing various modules for the Python programming language. It is a replacement for easy_install which was found in Python setup tools. To make things easier to understand, it shares similar syntax to other package managers such as Apt.
Pip not just only shares the syntax from popular package managers but also avails you of similar functionality such as it handles dependencies automatically and also the option to load modules directly from version control systems such as Git.
After covering the basics related to Pip, now we can move forward with the installation part of Pip. We are going to cover the installation of Pip3, Python2, and Pip2. So let’s start with the installation of Pip3 on Debian 11.
As Python 3 is pre-installed on Debian 11, we don’t need to install it on our system. To check the installed version of Python 3, use the following command:
python3 –version
But somehow, you are getting an error, you can download Python 3 by the given command:
sudo apt install python3
To install Pip3, use the following command:
sudo apt install python3-pip -y
To check whether we have successfully installed Pip3 on our system, use the following command which will show the version of installation:
pip –version
If you get output with the version number and directory of the installation, you have successfully installed Pip3 on your system.
As we want to run Pip2, we are required to install Python 2. Debian is not shipped with Python 2 so we are required to install it manually. Use the following command to install Python 2 on your Debian:
sudo apt install python2 -y
Once we are done with the installation of Python 2, we can easily check its version by the following command to cross-check whether we have installed Python 2 without any errors or not:
python2 –version
After installation of Python 2, let’s download and install the Pip installer by the following command:
sudo curl https://bootstrap.pypa.io/pip/2.7/get-pip.py –output get-pip.py
sudo python2 get-pip.py
Let’s check the installed version of Pip2 by the following command:
pip2 –version
After we are done with the installation part of Pip, we are going to show you how to download modules and also how to delete them. Let’s start with installing modules.
You will find various projects and modules from the Python package index. We are going to download the translator using Pip. Use the following command to install the translator:
pip3 install “translator”
Pip3 is used to download packages with the base of Python 3, if you want to install modules in Python 2, you will have to use pip2 instead of pip3.
As we regularly update our packages on Debian using sudo apt update to update our repositories and download the latest packages. Similarly, we are also required to update packages in Pip.
Use the following command to update modules in Pip:
python3 -m pip install –upgrade translator
Change the Python version and module name accordingly update packages that are using Python 2.
If you no longer require a particular module, you can easily remove it by the following syntax:
pip3/2 uninstall “<Package Name>”
We are going to remove the translator package as we no longer need it on our system by the following command:
pip3 uninstall “translator”
It will ask for your permission for deleting the requested module. Enter “y” and hit Enter. It will remove the requested packages.
If you no longer require Pip on your system, you can easily remove it from your system by following the given instructions.
To uninstall Pip3 from your system, use the following command:
sudo apt remove –auto-remove python3-pip
To uninstall Pip2, use the following command:
sudo pip uninstall pip
No, Debian does not come pre-installed with Pip. You have to install Pip manually.
We can easily check by getting the version number. If Pip is installed, it will show the version number. If now, it will through an error. You can check the version number of Pip3 by this command: pip –version
Pip can be a powerful tool especially if your work heavily depends on Python. By following this guide, you can easily configure, use, remove and install pip in Debian 11 and other Debian-based distros.
Related