How to Install Pip on Debian 10

By 

Published on

3 min read

Install Python Pip on Debian 10

Pip is a package management system that allows you to install Python packages. With pip, you can install packages from the Python Package Index (PyPI) and other repositories.

In this guide, we will explain how to install pip for both Python 2 pip and Python 3 pip3 on Debian 10, Buster, using the apt package manager. We will also show you how to install and manage Python packages with pip.

Installing pip for Python 3

Perform the following steps as a user with sudo privileges to install Pip for Python 3 on Debian 10:

  1. Start by updating the package list:

    Terminal
    sudo apt update
  2. Install pip for Python 3 and all of its dependencies with the following command:

    Terminal
    sudo apt install python3-pip
  3. Print the pip3 version to verify the installation:

    Terminal
    pip3 --version

    The version number may be different, but it will look something like the one below:

    output
    pip 18.1 from /usr/lib/python3/dist-packages/pip (python 3.7)

Installing pip for Python 2

The following steps describe how to install Pip for Python 2 on Debian systems:

  1. Start by updating the packages index:

    Terminal
    sudo apt update
  2. Install pip for Python 2 and all of its dependencies:

    Terminal
    sudo apt install python-pip
  3. Verify the installation by issuing the following command which will print the pip version:

    Terminal
    pip --version

    The version number may vary, but it will look something like this:

    output
    pip 18.1 from /usr/lib/python2.7/dist-packages/pip (python 2.7)

Using Pip

In this section, we will talk about the basic pip commands. With pip, you can install packages from PyPI, version control, local projects, and from distribution files but in most cases, you will install packages from PyPI.

If you want to install a python module globally, you should prefer to install it as a package using the apt manager. Use pip to install python modules globally only if there is no package available.

Usually, you would use pip inside a virtual environment only. Python Virtual Environment allows you to install Python modules in an isolated location for a specific project, rather than being installed globally. This way you do not have to worry about affecting other Python projects.

Let’s say you want to install a package named urllib3, you can do that by issuing the following command:

Terminal
pip install urllib3
Info
urllib3 is a powerful HTTP client for Python.

Uninstalling a package:

Terminal
pip uninstall package_name

Searching packages from PyPI:

Terminal
pip search "search_query"

Listing installed packages:

Terminal
pip list

Listing outdated packages:

Terminal
pip list --outdated

Conclusion

We have shown you how to install pip on your Debian system and how to manage Python packages using pip. For more information about pip, check the pip user guide .

If you have any questions or feedback, feel free to comment below.

Linuxize Weekly Newsletter

A quick weekly roundup of new tutorials, news, and tips.

About the authors

Dejan Panovski

Dejan Panovski

Dejan Panovski is the founder of Linuxize, an RHCSA-certified Linux system administrator and DevOps engineer based in Skopje, Macedonia. Author of 800+ Linux tutorials with 20+ years of experience turning complex Linux tasks into clear, reliable guides.

View author page