Friday, December 1, 2017

Package : Install Python PIP: A python package manager

Install Python PIP: A python package manager


PIP is a package management for python based softwares, PIP actually is a recursive acronym for ‘PIP installs python’ or ‘PIP install packages’. Using PIP, we can install install, uninstall the python based packages along with their required dependencies. Many of the packages can also be found at PyPI (Python Package Index).

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,
RHEL/CentOS 7
$ sudo rpm -Uvh https://dl.fedoraproject.org/pub/epel/7/x86_64/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 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”
& than 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 install ed on our system. Than run the following command to install all the packages,
$ pip install -r packages.txt
Where ‘packages.txt’ is the file with 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 complete list of options that can be used with PIP command, run
$ pip –help
That’s it guys. 

No comments: