How to install pip on CentOS 7
To install pip on CentOS 7
pip is a package management tool for used to install and manage Python packages. Python is an open-source, multi-platform and popular programming language with a design philosophy which emphasizes more on code readability. Since it has more focus on readability, it is considered to be an easy programming language.
Pre-Flight Check
- These instructions are intended specifically for installing Pip, a tool for installing and managing Python packages.
- I’ ll be working from a Liquid Web Core Managed CentOS 7 server, and I’ ll be logged in as root.
Installing pip
There are two options for installing pip. Use either Option #1 or Option #2 below.
Option #1: Install pip with Curl and Python
We can use curl and python to download and install pip
[root@linuxhelp1 ~]# curl " https://bootstrap.pypa.io/get-pip.py" -o " get-pip.py"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1558k 100 1558k 0 0 420k 0 0:00:03 0:00:03 --:--:-- 420k
Now install pip by using the following command.
[root@linuxhelp1 ~]# python get-pip.py
Collecting pip
/tmp/tmpDRoinP/pip.zip/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#snimissingwarning.
/tmp/tmpDRoinP/pip.zip/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB)
100% |????????????????????????????????| 1.3MB 226kB/s
Collecting wheel
Downloading wheel-0.29.0-py2.py3-none-any.whl (66kB)
100% |????????????????????????????????| 71kB 532kB/s
Installing collected packages: pip, wheel
Successfully installed pip-9.0.1 wheel-0.29.0
/tmp/tmpDRoinP/pip.zip/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
Verify The Installation
View a list of helpful commands by making use of --help
[root@linuxhelp1 ~]# pip --help
Usage:
pip < command> [options]
Commands:
install Install packages.
download Download packages.
uninstall Uninstall packages.
freeze Output installed packages in requirements format.
list List installed packages.
show Show information about installed packages.
check Verify installed packages have compatible dependencies.
search Search PyPI for packages.
wheel Build wheels from your requirements.
hash Compute hashes of package archives.
completion A helper command used for command completion.
help Show help for commands.
General Options:
-h, --help Show help.
--isolated Run pip in an isolated mode, ignoring environment variables and user
configuration.
-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. Option is additive, and can be used up to 3 times
(corresponding to WARNING, ERROR, and CRITICAL logging levels).
--log < path> Path to a verbose appending log.
--proxy < proxy> Specify a proxy in the form [user:passwd@]proxy.server:port.
--retries < retries> Maximum number of retries each connection should attempt (default 5
times).
--timeout < sec> Set the socket timeout (default 15 seconds).
--exists-action < action> Default action when a path already exists: (s)witch, (i)gnore,
(w)ipe, (b)ackup, (a)bort.
--trusted-host < hostname> Mark this host as trusted, even though it does not have valid or any
HTTPS.
--cert < path> Path to alternate CA bundle.
.
.
Check the version of pip that is installed by running the following command.
[root@linuxhelp1 ~]# pip -V
pip 9.0.1 from /usr/lib/python2.7/site-packages (python 2.7)
Option #2: Install Pip with Yum
Add the EPEL Repository through the following command.
[root@linuxhelp1 ~]# rpm -iUvh https://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-8.noarch.rpm
Retrieving https://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-8.noarch.rpm
warning: /var/tmp/rpm-tmp.gYs7ep: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:epel-release-7-8 ################################# [100%]
Then let’ s install python-pip and any required packages.
[root@linuxhelp1 ~]# yum -y install python-pip
Loaded plugins: fastestmirror, langpacks
base | 3.6 kB 00:00:00
epel/x86_64/metalink | 7.1 kB 00:00:00
epel | 4.3 kB 00:00:00
http://epel.mirror.net.in/epel/7/x86_64/repodata/repomd.xml: [Errno -1] repomd.xml does not match metalink for epel
Trying other mirror.
epel | 4.3 kB 00:00:00
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00
(1/4): epel/x86_64/group_gz | 170 kB 00:00:01
(2/4): epel/x86_64/updateinfo | 696 kB 00:00:06
(3/4): updates/7/x86_64/primary_db | 1.2 MB 00:00:15
(4/4): epel/x86_64/primary_db | 4.4 MB 00:00:33
Determining fastest mirrors
.
.
Installed:
python2-pip.noarch 0:8.1.2-5.el7
Complete!
You can check the version of PHP by using -V option.
[root@linuxhelp1 ~]# pip -V
pip 8.1.2 from /usr/lib/python2.7/site-packages (python 2.7)
Comments ( 0 )
No comments available