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
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.
- Dive Deep Into Python Vs Perl Debate – What Should I Learn Python or Perl?
- Getting Started with Python Programming and Scripting in Linux
- How to Use Python ‘SimpleHTTPServer’ to Create Webserver or Serve Files Instantly
- 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.
21 thoughts on “How To Install PIP to Manage Python Packages in Linux”
Hi, I’m currently running centos8 and trying to install ansible but when I run the install, the command line prompts that I need to update to the latest PIP, how would I go about doing this?
Just run the following command to update the PIP to latest version.
I have seen this same issue with many others online (/usr/bin/python: No module named pip) after following install instructions and many others maybe’s still no success.
For Python 3
For Python 2