How To Install PIP to Manage Python Packages in Linux

Pip (recursive acronym for “Pip Installs Packages” or “Pip Installs Python“) is a cross-platform package manager for installing and managing Python packages (which can be found in the Python Package Index (PyPI)) that comes with Python 2 >=2.7.9 or Python 3 >=3.4 binaries that are downloaded from python.org.

Suggested Read: How to Install Latest Python 3.6 Version in Linux

In this article, we will explain how to install PIP on mainstream Linux distributions.

Note: We will run all commands as the root user, if you are managing your system as a normal user, then use the sudo command to get root privileges or you can as well configure your system to run sudo command without entering a password, it’s possible. Try it out!

Install PIP in Linux Systems

To install pip in Linux, run the appropriate command for your distribution as follows:

Install PIP On Debian/Ubuntu

# apt install python-pip	#python 2
# apt install python3-pip	#python 3

Install PIP On CentOS and RHEL

Unluckily, pip is not packaged in official software repositories of CentOS/RHEL. So you need to enable the EPEL repository and then install it like this.

# yum install epel-release 
# yum install python-pip

Install PIP on Fedora

# dnf install python-pip	#Python 2
# dnf install python3		#Python 3

Install PIP on Arch Linux

# pacman -S python2-pip	        #Python 2
# pacman -S python-pip	        #Python 3

Install PIP on openSUSE

# zypper install python-pip	#Python 2
# zypper install python3-pip	#Python 3

How to Use PIP in Linux Systems

To install, uninstall or search new packages, use these commands.

# pip install packageName
# pip uninstall packageName
# pip search packageName

To see a list of all commands type:

# pip help
Sample Output
Usage:   
  pip <command> [options]

Commands:
  install                     Install packages.
  download                    Download packages.
  uninstall                   Uninstall packages.
  freeze                      Output installed packages in requirements format.
  list                        List installed packages.
  show                        Show information about installed packages.
  check                       Verify installed packages have compatible dependencies.
  search                      Search PyPI for packages.
  wheel                       Build wheels from your requirements.
  hash                        Compute hashes of package archives.
  completion                  A helper command used for command completion.
  help                        Show help for commands.

You may also like to read these following related articles about Python.

  1. Dive Deep Into Python Vs Perl Debate – What Should I Learn Python or Perl?
  2. Getting Started with Python Programming and Scripting in Linux
  3. How to Use Python ‘SimpleHTTPServer’ to Create Webserver or Serve Files Instantly
  4. Python-mode – A Vim Plugin to Develop Python Applications in Vim Editor

In this article, we showed you how to install PIP on mainstream Linux distributions. To ask any questions relating to this topic, please take advantage of the feedback form below.

Best Affordable Linux and WordPress Services For Your Business
Outsource Your Linux and WordPress Project and Get it Promptly Completed Remotely and Delivered Online.

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Aaron Kili

Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

9 Responses

  1. Jai Maruthi says:

    Thanks for the tutorial.

    I had trouble running ‘pip‘ command after the python3-pip was successfully installed. I kept getting the ‘Command ‘pip’ not found, but can be installed with: sudo apt install python-pip‘ error. Until I figured out the pip for python3 installed as ‘pip3‘ not just pip. :D.

  2. N. P. says:

    Thanks a bunch! I’m a Kubuntu user and I modified your code for installing on Debian/Linux slightly (to what I’m used to using for downloading via the terminal) and used the following:

    $ sudo apt-get install python3-pip
    

    Download worked smoothly for me: not a single error message!

    As a side note, I already had a version of python 3 (3.4.3) installed on my machine.

    Thanks again!

  3. Vani says:

    How to overcome the problem.. Pip location not found.. While installing pip in boss linux

  4. surya says:

    Often requqies super user permission

  5. Omkar Panda says:

    Hello,

    I am using RedHat Linux and trying to install CV2 and PIP for comparing pixel by pixel of two image in Python 2.7. But still getting below issues.

    Error:
    1> 
    OSError: Cython needs to be installed
    Traceback (most recent call last):
    File "setup.py", line 410, in 
    setup_package()
    File "setup.py", line 393, in setup_package
    generate_cython()
    File "setup.py", line 214, in generate_cython
    raise RuntimeError("Running cythonize failed!")
    RuntimeError: Running cythonize failed!
    $
    2> 
    /usr/local/lib/python2.7/site-packages/cStringIO.so: undefined symbol: PyCapsule_New
    

    Please let me know it is possible to install in redhat Linux or will skip it to other module.

  6. gaamy says:

    Use “pip3” to invoke pip if you installed the python3-pip package

    pip3 help

Leave a Reply to N. P. Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.