PIP is the alternate python package installer. pip is famous for easily managing the python based packages. As well as, with the help of pip you can also install the package of particular version. Most importantly pip has a feature to manage full lists of packages and corresponding version numbers, possible through a “requirements” file.
It performs the same basic job as easy_install, but with some extra features. It can work with version control repositories (currently only Git, Mercurial, and Bazaar repositories), logs output extensively, and prevents partial installs by downloading all requirements before starting installation.
It has some disadvantages when compared to easy_install. It does not use egg files, although it does preserve egg metadata. Some setuptools features are not yet supported, and some custom setup.py features won´t work.
Install pip on CentOS / RHEL
First install the EPEL repo as per your Operating system version and architecture.
For detail study, you can read our previous post on EPEL.
For RHEL 7.x and CentOS 7.x (x86_64)
We have already written post on “Install EPEL repo on CentOS 7 / RHEL 7” with more details. Below given command will install EPEL repo on CentOS 7 / RHEL 7.
yum install epel-release
For RHEL 6.x and CentOS 6.x (x86_64)
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
For RHEL 6.x and CentOS 6.x (i386)
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
Installing pip with yum command
Now install pip with yum command
yum install -y python-pip
The pip rpm will be installed. You can confirm it by using following command.
See below given reference :
[root@localhost ~]# which pip /usr/bin/pip [root@localhost ~]# [root@localhost ~]# rpm -qa|grep pip python-pip-1.3.1-4.el6.noarch [root@localhost ~]#
Install pip on Debian / Ubuntu
Install the pip by using apt-get command
sudo apt-get update sudo apt-get install python-pip
In Ubuntu 16.04 LTS or above install the pip by using apt command.
sudo apt update sudo apt install python-pip
To confirm the package installation.Given below is the reference from my system
sharad@ubuntu:~$ sudo dpkg -l|grep pip [sudo] password for sharad: ii libpipeline1:amd64 1.3.0-1 amd64 pipeline manipulation library ii python-pip 1.5.4-1 all alternative Python package installer sharad@ubuntu:~$ sharad@ubuntu:~$ which pip /usr/bin/pip sharad@ubuntu:~$
How to use pip command
After installing python-pip package, the pip command will be available on system.
There are multiple options available with pip command.
Most commonly used are install and uninstall of python package.
For installing package with pip command
Use below given syntax :
sudo pip install python-package-name
For uninstalling package with pip command
Use below given syntax
sudo pip uninstall python-package-name
Use –help switch along with pip command, to get more options. Read the below options, it is quite easy to use.
sharad@ubuntu:~$ pip --help Usage: pip <command></command> [options] Commands: install Install packages. uninstall Uninstall packages. freeze Output installed packages in requirements format. list List installed packages. show Show information about installed packages. search Search PyPI for packages. wheel Build wheels from your requirements. zip DEPRECATED. Zip individual packages. unzip DEPRECATED. Unzip individual packages. bundle DEPRECATED. Create pybundles. help Show help for commands. General Options: -h, --help Show help. -v, --verbose Give more output. Option is additive, and can be used up to 3 times. -V, --version Show version and exit. -q, --quiet Give less output. --log-file Path to a verbose non-appending log, that only logs failures. This log is active by default at /home/sharad/.pip/pip.log. --log Path to a verbose appending log. This log is inactive by default. --proxy Specify a proxy in the form [user:passwd@]proxy.server:port. --timeout Set the socket timeout (default 15 seconds). --exists-action Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup. --cert Path to alternate CA bundle. sharad@ubuntu:~$