How to install pip on Linux

Last updated on January 14, 2021 by Dan Nanni

Question: I want to use pip to install Python packages. However, when I run pip, it says "pip: command not found". How can I install pip on [insert your Linux distro]?

There are various ways to install and manage Python packages. One of the easiest way is to use pip (or pip3 for Python3) command line tool. Using pip (or pip3), you can install/update/uninstall a Python package, as well as list all installed (or outdated) packages from the command line.

Install pip on Ubuntu, Debian or Linux Mint

$ sudo apt-get install python-pip    # for Python2
$ sudo apt-get install python3-pip   # for Python3

Note that on Ubuntu 20.04 or later, python-pip is no longer included in their repositories. Thus if you want to install pip on newer Ubuntu systems, you need to install it from the official source, as described at the end of this tutorial.

Install pip on Fedora or CentOS/RHEL 7 or Later

No third-party repository is needed to install pip amd pip3.

$ sudo yum install python-pip   # for Python2
$ sudo yum install python3-pip   # for Python3

Install pip on CentOS or RHEL 6 or Earlier

To install pip on old CentOS/RHEL system, first enable EPEL repository, and then run:

$ sudo yum install python-pip   # for Python2

Install pip on Arch Linux or Manjaro

$ sudo pacman -S python2-pip   # for Python2
$ sudo pacman -S python-pip    # for Python3

Install pip on OpenSUSE

$ sudo zypper install python-pip   # for Python2
$ sudo zypper install python3-pip  # for Python3

Install pip from the Official Source

If you want to install pip or pip3 from the official source directly, you can use the following commands.

For pip:

$ wget https://bootstrap.pypa.io/get-pip.py
$ sudo python2 get-pip.py

For pip3:

$ wget https://bootstrap.pypa.io/get-pip.py
$ sudo python3 get-pip.py

Support Xmodulo

This website is made possible by minimal ads and your gracious donation via PayPal (Credit Card) or Bitcoin (BTC Wallet: 1M161JGAkz3oaHNvTiPFjNYkeABox8rb4g).

Xmodulo © 2020 ‒ About ‒ Powered by DigitalOcean