How to Install Pip on Debian 12
3 min read
Pip is a tool for installing Python packages. With pip, you can search, download, and install packages from the Python Package Index (PyPI) and other package indexes.
This tutorial explains how to install pip for Python 3
pip3 on Debian 11 and 12 using the
We will also show you how to install and manage Python packages with pip.
Installing Pip on Debian
Pip for Python 3 is included in the default Debian repositories, and the installation is pretty straightforward.
Run the following commands to refresh the local package index and install Pip and all of its dependencies:
sudo apt update
sudo apt install python3-pip
To ensure that pip has been installed correctly on your system, you can check its version by typing:
The version number may be different, but it will look something like the one below:
pip 23.0.1 from /usr/lib/python3/dist-packages/pip (python 3.11)
When a new version is released, you can update the “python3-pip” package through the command line or your desktop Software Update tool.
With Pip, you can install packages from PyPI and other sources, manage package versions, update packages, remove packages and more.
Python modules can be installed globally (accessible for all projects and users) or on a project basis.
If you want to install a Python module globally, you should prefer to install it as a package using the
apt manager. Use ip to install Python modules globally only if no package is available.
Pip is mostly used inside a virtual environment. Python
allows you to install Python modules in an isolated location for a specific project rather than being installed globally. This will prevent issues caused by shared dependencies and libraries.
In this section, we will explore the basic usage of pip.
To get a list of all pip commands and options, type:
You can get more information about a specific command using
pip <command> --help . For example, to get more information about the install command, type:
pip3 install --help
Installing Packages with Pip
The most basic function of the pip tool is to install a package.
To install the latest version of a package, you would run the following command:
pip3 install <package_name>
Let’s say you want to install the tensorflow library. You can do that by typing:
pip3 install tensorflow
To install a specific version of a package, append
== and the version number after the package name:
pip3 install tensorflow==2.13.0
Installing Packages with Pip using the Requirements Files
requirement.txt is a text file containing a list of pip packages and their versions required to run a specific Python project.
To install a list of requirements specified in a file, use the following command:
pip3 install -r requirements.txt
Listing Installed Packages
To list all the installed pip packages, use the “list” subcommand:
Upgrade a Package With Pip
To upgrade an already installed package to the latest version, enter:
pip3 install --upgrade package_name
Uninstalling Packages With Pip
To uninstall a package, run:
pip3 uninstall package_name
We have shown you how to install pip on your Debian machine and manage Python packages using pip. For more information about pip, visit the pip user guide page.
If you have any questions or feedback, feel free to comment below.