The objective of this article is to show you how to install Pip 2 / Pip3 Python package manager on Debian 10 / Debian 9 Linux distribution. Pip is a package management system used to install and manage software packages written in Python. Pip is mostly used to install packages available in Python Package Index (PyPI). Developers can also use Pip to install modules and packages developed locally.

Similar: Install Django on Debian 10 / Debian 9

The default installation of Debian 10 doesn’t come with Pip. Pip can be installed on Debian 10 from the apt repository, with get-pip installer script or my manually building the application from source.

Install Pip on Debian 10 / Debian 9 Linux

Before starting the installation, you need to login to your installed Debian system as a user with sudo privileges. Once in, update your system packages.

sudo apt update
sudo apt -y upgrade

Before you go any further, you should have expected Python version available from your command line. Use the following command to check:

$ python -V
Python 2.7.16

$ python3 -V
Python 3.7.3

After the upgrade, use the following methods to install Pip on Debian 10 (Buster).

Install Pip for Python 2 on Debian 10 / Debian 9

For Python 2 users, run the command below to install Pip on Debian 10 Linux.

sudo apt update
sudo apt install python-pip

Confirm installation:

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

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

Install Pip for Python 3 on Debian 10 / Debian 9

If you’re working with Python 3 in your projects, then run the command below to install Pip for Python 3 in Debian 10 (Buster).

sudo apt update
sudo apt install python3-venv python3-pip

If installation of Pip on Debian 10/9 was successful, you should be able to check the version from CLI.

$ pip3 --version
pip 18.1 from /usr/lib/python3/dist-packages/pip (python 3.7)

Using Pip on Debian 10 / Debian 9 Linux

The most standard Python modules are distributed as Debian packages in APT repositories for Debian Linux. If the package is not available, you can use pip|pip3 command to install it globally or locally to the user environment. Let’s consider two examples of installing awscli Python package.

Install in user space


# Python 2
$ pip2 install --user awscli

# Python 3
$ pip3 install --user awscli

Add the /home/$USER/.local/bin to your PATH if it doesn’t exist.

Check:

$ env | grep PATH
PATH=/home/debian/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

If you don’t see /home/username/.local/bin in the output, add like below.

$ nano ~/.bashrc
export PATH="$PATH:/home/$USER/.local/bin"

$ source ~/.bashrc
$ env | grep PATH

You can then view package details

$ pip2 show awscli
Name: awscli
Version: 1.16.254
Summary: Universal Command Line Environment for AWS.
Home-page: http://aws.amazon.com/cli/
Author: Amazon Web Services
Author-email: UNKNOWN
License: Apache License 2.0
Location: /usr/local/lib/python2.7/dist-packages
Requires: s3transfer, colorama, PyYAML, docutils, botocore, rsa
Required-by: 

Install Python Packages globally on Debian 10

If you want installed packages to be available to all users, install them globally. Examples:

# Python 2
$ sudo pip2 install awscli

# Python 3
$ sudo pip3 install awscli

Installation output sample.

install pip on Debian 10

Standard Pip Cheat Sheet

Search for package:

pip search <packagename>

Install a package:

pip install <packagename>

Show details of a package

 pip show <packagename>

Install a package in user space

pip install --user <packagename>

Upgrade a package:

pip install -r requirements.txt

List all outdated packages:

pip list --outdated

You have installed Pip on Debian 10 Linux distribution successfully. Check other guides available related to Pip/Python.

How to Install pip Python package manager on FreeBSD 12

How To Install Pip3 & Django on Ubuntu 18.04 / Ubuntu 16.04

How To Dockerize a Django Application on Ubuntu / Debian / CentOS