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 )
(Also read: Using yum to download packages without installing them)
Install Python PIP on CentOS/RHEL
To install PIP on CentOS machines, we need to have the EPEL repository installed on our machines. Use the appropriate links among the following based on your OS to install EPEL repository,
RHEL/CentOS 8
$ sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
RHEL/CentOS 7
$ 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.
Also check out: Grow your business network with SD WAN
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 the PIP command, run
$ pip --help
That's it, guys for our guide on how to install Python pip on Ubuntu & also on CentOS/RHEL. Also, if you want you can let a Python expert to help do your homework of any complexity if you are ready to pay someone online. This completes our tutorial, feel free to send your suggestions or questions using the comment box below.
We are giving you exclusive deals to try Linux Servers for free with 100$ credit, check these links to claim your 100$,
DigitalOcean - 100$ free credit & Linode - 100$ free credit
Check some Exclusive Deals, HERE.
Also, check out DevOps Book You should read section.