Administration toolsCommands

Install PIP to manage python packages in linux

Pip (recursive acronym for “Pip Installs Packages” or “Pip Installs Python“) is the package management system for Python, used to install and manage software packages written in Python. Pip is the similar tool like the bundle, npm, composer in another programming language.
In this tutorial, we will show you how to install Python Pip on mainstream Linux distributions.

Install PIP in Linux Systems

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

Install PIP On Debian/Ubuntu

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

Check the install version of pip on your system using -V command line switch.

$ pip -V     
$ pip3 -V        # For specific python version

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.

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

Install PIP on Fedora

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

How to use Pip in linux systems

Now that we have seen how to install various versions of pip in different python environments, it’s time to see how we can use it to install, upgrade and uninstall packages.
To list all the commands in PIP enter following:

$ pip --help    #Python2
$ pip3 --help   #Python3

Get information of specific command enter following

$ pip install --help    #Python2
$ pip3 install --help   #Python3

To search package with PIP enter following

$ pip search PACKAGE_NAME    #Python2
$ pip3 search PACKAGE_NAME   #Python3

Install package with PIP enter following in terminal

$ pip install PACKAGE_NAME    #Python2
$ pip3 install PACKAGE_NAME   #Python3

To install package from requirements file

$ pip install -r requirements.txt    #Python2
$ pip3 install -r requirements.txt   #Python3

Upgrade package with PIP

$ pip install --upgrade PACKAGE_NAME    #Python2
$ pip3 install --upgrade PACKAGE_NAME   #Python3

Uninstall package with PIP

$ pip uninstall PACKAGE_NAME    #Python2
$ pip3 uninstall PACKAGE_NAME   #Python3

Conclusion

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.

Leave a Reply

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

CAPTCHA


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

Back to top button