The pip command is a tool for installing and managing Python packages, such as those found in the Python Package Index. It’s a replacement for easy_install. pip is very useful for web development as well as for sys-admins who manages cloud computing based resources created Openstack, Rackspace, AWS, Google and other cloud computing service providers.
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 setup tools 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 RHEL 7.x and CentOS 7.x (x86_64)
To install PIP in RHEL/CentOS 7.x use following commends,
# yum install epel-release (if you are getting failed, use next step or skip it.)
Step 1a: Install pip from EPEL for RHEL/CentOS 7.x
# wget -r –no-parent -A ‘epel-release-*.rpm’ http://dl.fedoraproject.org/pub/epel/7/x86_64/e/
# rpm -Uvh dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-*.rpm
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@foxutech ~]# which pip
/bin/pip
[root@foxutech ~]# whereis pip
pip: /usr/bin/pip /usr/bin/pip2.7
[root@foxutech ~]# rpm -qa|grep pip
python-pip-1.3.1-4.el6.noarch
Alternate method:
Install Pip with Curl and Python
We can also use curl and python to download and install Pip.
# curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py"
# python get-pip.py
Install pip on Debian / Ubuntu
Install the pip by using apt-get command
# apt-get update
# apt-get install python-pip
To confirm the package installation.Given below is the reference from my system
root@foxuntu:~# sudo dpkg -l|grep pip
ii python-pip 1.5.4-1ubuntu4 all alternative Python package installer
ii python-pip-whl 1.5.4-1ubuntu4 all alternative Python package installer
root@foxuntu:~# which pip
/usr/bin/pip
How to use pip
After installing python-pip package, the pip command will be available on system.
There are multiple options available with pip command.
Most commonly we used for install and uninstall of python package.
For installing package with pip command
Use below given syntax:
# pip install python.package.name
For uninstalling package with pip command
Use below given syntax
# pip uninstall python.package.name
To Search available packages
# pip search openstack
Use –help switch along with pip command, to get more options.
root@foxuntu:~# 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.
root@foxuntu:~#