This tutorial explains how to install PIP for Python 3 and Python 2 on Debian 11 and other Debian-based Linux distributions, such as Ubuntu.
PIP (Pip Installs Packages) is a package manager written in Python that is used to install software from repositories. If you don’t know PIP, you can think of it as a tool similar to the Debian apt command. Basically, the syntax for installing packages using the PIP package manager is pip install <package>.
This tutorial covers PIP installation for both Python 3 and Python 2, even though Python 2 is not supported by default with Debian repositories. This article also explains how to get both versions of PIP with just one command. Also, I added instructions to keep PIP up to date and use it to install the software.
Installing PIP3 on Debian 11
To get started, update the package repositories by running the apt command, followed by the update option as shown below: <img src="https://linuxhint.com/wp-content/uploads/2021/11/install-pip-on-debian-11-01.png"
alt=”” />
You can install Python (3) also using the apt command followed by the installation option as shown below:
<img
src=”https://linuxhint.com/wp-content/uploads/2021/11/install-pip-on-debian-11-02.png” alt=”” />
To check your Python 3 version, you can run
the following command:
Then install PIP3 by running the following command:
<img src
=”https://linuxhint.com/wp-content/uploads/2021/11/install-pip-on-debian-11-04.png”
alt=”” />
To check the PIP
version, run the following command:
As
you can see, PIP
for Python 3 is installed. Installing PIP2 on Debian 11 As discussed, although Python 2 is still available for
Debian 11
, it does not support PIP2 in the package manager. However, you can install it
by following the steps explained below: Use the
apt command to install the python2 package as shown below
: Once Python 2
is installed, download and run the pip installer for Python 2 by running the following command:
<img src
=”https://linuxhint.com/wp-content/uploads/2021/11/install-pip-on-debian-11-07.png” alt=”” /> You can check your Python 2 version by running the following command:
To check Python
2 and pip versions, run the following command:
As you can see, PIP for Python 2 is installed.
Keep PIP up to date
You can use the command shown in the following screenshot to keep PIP up to date:
PIP
and its components are now up to date
. Using PIP to install software As mentioned earlier,
PIP
is a package manager used to install software written in Python. The syntax for installing packages is quite simple. Simply run PIP followed by the installation option and package name. The syntax for installing a package is the same as with the apt command.
For example
:
As you can see, the package was installed successfully
.
You can find projects available for download on https://pypi.org.
To update packages using PIP, run the following command:
<img src
=”https://linuxhint.com/wp-content/uploads/2021/11/install-pip-on-debian-11-12.png”
alt=”” />
In this case, the software was already current
.
Uninstalling packages using PIP
To remove packages using PIP,
use the following syntax. When prompted for confirmation, press Y.
To remove the translator package, run the following command. When prompted for confirmation, press Y.
<img
src=”https://linuxhint.com/wp-content/uploads/2021/11/install-pip-on-debian-11-13.png” alt=”” />
And as you can see in the screenshot below, the package was successfully removed:
Conclusion
Thank you for reading this tutorial that explains how to install PIP on Debian 11 Bullseye. As you can see, installing PIP for Python 3 and Python 2 is pretty easy. Any Linux-level user can do so by following some steps explained in this article.
Even though this tutorial shows PIP for Python 2 installation, it is not recommended. Instead, use Python 3. Also, remember to keep PIP and its components up to date using the commands explained for this purpose.
Thanks again for learning from Linux Hint. Keep following us for additional tips and tutorials.