CentOS7上pip的安装方式

在这里插入图片描述
本文用于记录两种在CentOS 7上安装pip的方法。

方式1: yum方式

步骤1: 安装epel-release

执行命令:yum install -y epel-release

步骤2: enable epel

执行命令:yum-config-manager --enable epel

[root@liumiaocn ~]# yum-config-manager --enable epel
...省略
[epel]
async = True
...省略
ui_id = epel/x86_64
ui_repoid_vars = releasever,
   basearch
username = 

[root@liumiaocn ~]#

步骤3: 安装pip

执行命令:yum install python-pip

[root@liumiaocn ~]# yum install python-pip
...省略
========================================================================================================================================
 Package                            Arch                          Version                             Repository                   Size
========================================================================================================================================
Installing:
 python2-pip                        noarch                        8.1.2-10.el7                        epel                        1.7 M

Transaction Summary
========================================================================================================================================
Install  1 Package

Total download size: 1.7 M
Installed size: 7.2 M
Is this ok [y/d/N]: y
...省略
Installed:
  python2-pip.noarch 0:8.1.2-10.el7                                                                                                     

Complete!
[root@liumiaocn ~]# 

步骤4: 确认版本

执行命令:pip --version

[root@liumiaocn ~]# pip --version
pip 8.1.2 from /usr/lib/python2.7/site-packages (python 2.7)
[root@liumiaocn ~]# 

方法2:使用python安装pip

使用get-pip.py的python脚本来进行pip的安装,主要使用如下两步即可

步骤1: 下载get-pip.py脚本

可使用curl或者wget或者其他任意方式下载get-pip.py安装脚本。

执行命令:curl “https://bootstrap.pypa.io/get-pip.py” -o “get-pip.py”

执行日志如下所示:

[root@liumiaocn ~]# 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 1734k  100 1734k    0     0  6934k      0 --:--:-- --:--:-- --:--:-- 6936k
[root@liumiaocn ~]# ls get-pip.py 
get-pip.py
[root@liumiaocn ~]#

步骤2: 执行安装脚本

[root@liumiaocn ~]# python get-pip.py 
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting pip
  Downloading https://files.pythonhosted.org/packages/00/b6/9cfa56b4081ad13874b0c6f96af8ce16cfbc1cb06bedf8e9164ce5551ec1/pip-19.3.1-py2.py3-none-any.whl (1.4MB)
     |################################| 1.4MB 14.7MB/s 
Collecting wheel
  Downloading https://files.pythonhosted.org/packages/00/83/b4a77d044e78ad1a45610eb88f745be2fd2c6d658f9798a15e384b7d57c9/wheel-0.33.6-py2.py3-none-any.whl
Installing collected packages: pip, wheel
Successfully installed pip-19.3.1 wheel-0.33.6
[root@liumiaocn ~]# 

注:DEPRECATION提示的信息只是提示Python2即将过保。

发布了920 篇原创文章 · 获赞 1260 · 访问量 389万+
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 数字20 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览