PIP is a package manager for python-based software, PIP actually is a recursive acronym for 'PIP installs python' or 'PIP install packages'. Using PIP, we can install, uninstall the python based packages along with their required dependencies. Many of the packages can also be found at PyPI (Python Package Index).
In this tutorial, we will discuss how we can install PIP on our CentOS & Ubuntu machines.
(Recommended Read: Brief & Simple guide to install SLACK on Ubuntu )
Install Python PIP on CentOS
To install PIP on CentOS machines, we need to have EPEL repository installed on our machines. Use the appropriate links among the following based on your OS to install EPEL repository,
$ sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
$ sudo rpm -Uvh https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm
RHEL/CentOS 6 (64 Bit)
$ sudo rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
RHEL/CentOS 6 (32 Bit)
$ sudo rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
After this step, run the following command in your terminal to install PIP,
$ sudo yum install python-pip
Install Python PIP on Ubuntu
For Ubuntu, we don't need to install any repository as PIP is available with the default Ubuntu repository. To install PIP on Ubuntu machines, execute the following commands,
$ sudo apt-get update && sudo apt-get upgrade -y
$ sudo apt-get install python-pip
This will install PIP along with all the required dependencies on the Ubuntu machines.
install Python PIP using the script
We can also install PIP on most of the Linux distributions including Ubuntu, CentOS using this method. For this method, we will download a script using the following command,
$ curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py"
& then use the script to install PIP on the machine, with this command,
$ python get-pip.py
This will install PIP on our Linux machines along with the required dependencies.
Basic PIP commands
We will now discuss some of the commonly used PIP commands for package management. To install a package using PIP, use the following command,
$ pip install package_name
To install a number of packages, we can create a file & mention all the packages we need to have to install ed on our system. Then run the following command to install all the packages,
$ pip install -r packages.txt
Where 'packages.txt' is the file with a list of all the packages. To remove a package, run
$ pip uninstall package_name
Command to only download a package & not install it is,
$ pip download package_name
To list installed packages,
$ pip list
For a complete list of options that can be used with PIP command, run
$ pip --help
That's it, guys for our guide on how to install python pip. This completes our tutorial, feel free to send your suggestions or questions using the comment box below.