Learn how to – Install Pip3 & Pip2 on Debian 11/10/9.
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 Linux
The default installation of Debian doesn’t come with Pip. Pip can be installed on Debian from the apt repository, with get-pip installer script or my manually building the application from source.
Install Pip on Debian 11/10/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 full-upgrade
[ -f /var/run/reboot-required ] && sudo reboot -f
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.9.2
After the upgrade, use the following methods to install Pip on Debian 11/10/9 system.
Install Pip for Python 2 on Debian 10/9
For Python 2 users, run the command below to install Pip on Debian 10 Linux.
sudo apt update
sudo apt install python-pip
Upgrade PIP after installation
sudo pip install --upgrade pip
Confirm installation:
$ pip2 --version
pip 20.3.4 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)
$ pip --version
pip 20.3.4 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)
Install Pip for Python 3 on Debian 11/10/9
If you’re working with Python 3 in your projects, then run the command below to install Pip for Python 3 in Debian:
sudo apt update
sudo apt install python3-venv python3-pip
Upgrade Pip installed:
sudo -H pip3 install --upgrade pip
If installation of Pip on Debian 10/9 was successful, you should be able to check the version from CLI.
# Debian 10
$ pip3 --version
pip 22.1 from /usr/local/lib/python3.7/dist-packages/pip (python 3.7)
# Debian 11
$ pip3 --version
pip 22.1 from /usr/local/lib/python3.9/dist-packages/pip (python 3.9)
Using Pip / Pip3 on Debian 11/10/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.
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|pip3 on Debian 11/10/9 Linux distribution successfully.
Python & Django Programing Video Courses:
- Learn Python Programming Masterclass
- Python and Django Full Stack Web Developer Bootcamp
- The Complete Python Course | Learn Python by Doing
- The Python Mega Course: Build 10 Real World Applications
- Python Django – The Practical Guide
- The Python Bibleâ„¢ | Everything You Need to Program in Python
Check other guides available related to Pip/Python.
- Install pip Python package manager on FreeBSD 12
- How To Install Pip3 & Django on Ubuntu
- How To Dockerize a Django Application on Ubuntu / Debian / CentOS
Leave a Reply
You must be logged in to post a comment.