How to install Pip3 and Pip2 on Debian 10 / Debian 9

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

Similar: Install Django on Debian 10 / Debian 9

Pip does not come with a default installation of Debian 10. Pip can be installed from Debian 10 via the get-pip installer script in the apt repository or an app I manually built from source.

Install Pip on Debian 10 / Debian 9 Linux

Before starting the installation, you need to login to the installed Debian system as a user with sudo privileges. After entering, update the system software package.

sudo apt update
sudo apt -y upgrade

Before proceeding, you should already have an available Python version from the command line. Use the following command to check:

$ python -V
Python 2.7.16

$ python3 -V
Python 3.7.3

After upgrading, use the following method to install Pip on Debian 10 (Buster).

Install Pip for Python 2 on Debian 10 / Debian 9

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

sudo apt update
sudo apt install python-pip

Confirm the 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 are using Python 3 in your project, run the following command to install Pip for Python 3 in Debian 10 (Buster).

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

If you successfully installed Pip on Debian 10/9, you should be able to check the version from the 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 the APT repository of Debian Linux. If the package is not available, you can use pip | pip3 The command is installed globally or locally into the user environment. Let us consider two installation examples Oxley Python package.

Install in user space

# Python 2
$ pip2 install --user awscli

# Python 3
$ pip3 install --user awscli

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


$ env | grep PATH

If you can’t see /home/username/.local/bin In the output, add as shown below.

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

$ source ~/.bashrc
$ env | grep PATH

You can then view the details of the package

$ pip2 show awscli
Name: awscli
Version: 1.16.254
Summary: Universal Command Line Environment for AWS.
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

Install Python packages globally on Debian 10

If you want all users to have installed packages, install them globally. example:

# Python 2
$ sudo pip2 install awscli

# Python 3
$ sudo pip3 install awscli

Install the output sample.

Standard idea cheat sheet

Search package:

pip search 

Install the package:

pip install 

Show packaging details

 pip show 

Install packages in user space

pip install --user 

Upgrade package:

pip install -r requirements.txt

List all obsolete packages:

pip list --outdated

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

How to install pip Python package manager on FreeBSD 12

How to install Pip3 and Django on Ubuntu 18.04 / Ubuntu 16.04

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