CentOS7安装python-pip - magic_zero
2017-3-6 22:14:0 Author: www.cnblogs.com(查看原文) 阅读量:5 收藏

python中的一个十分好用的包管理工具python-pip是我们使用python必不可少的一件工具。但是在CentOS7安装时候却遇到了一些小问题:

[[email protected] magic]# yum install python-pip
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.btte.net
 * extras: mirrors.btte.net
 * updates: mirrors.btte.net
没有可用软件包 python-pip。
错误:无须任何处理

查阅资料以后,原来是因为CentOS官方的源有些时候滞后导致的。所以我们可以用fedora社区打造的EPEL(http://fedoraproject.org/wiki/EPEL)来进行安装:

[[email protected] magic]# sudo yum -y install epel-release
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.btte.net
 * extras: mirrors.btte.net
 * updates: mirrors.btte.net
正在解决依赖关系
--> 正在检查事务
---> 软件包 epel-release.noarch.0.7-9 将被 安装
--> 解决依赖关系完成

依赖关系解决

=============================================================================================================
 Package                       架构                    版本                    源                       大小
=============================================================================================================
正在安装:
 epel-release                  noarch                  7-9                     extras                   14 k

事务概要
=============================================================================================================
安装  1 软件包

总下载量:14 k
安装大小:24 k
Downloading packages:
警告:/var/cache/yum/x86_64/7/extras/packages/epel-release-7-9.noarch.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID f4a80eb5: NOKEY
epel-release-7-9.noarch.rpm 的公钥尚未安装
epel-release-7-9.noarch.rpm                                                           |  14 kB  00:00:00file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 检索密钥
导入 GPG key 0xF4A80EB5:
 用户ID     : "CentOS-7 Key (CentOS 7 Official Signing Key) <[email protected]>"
 指纹       : 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
 软件包     : centos-release-7-3.1611.el7.centos.x86_64 (@anaconda)
 来自       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : epel-release-7-9.noarch                                                                  1/1 
  验证中      : epel-release-7-9.noarch                                                                  1/1 

已安装:
  epel-release.noarch 0:7-9                                                                                  

完毕!

然后再来安装python-pip:

[[email protected] magic]# sudo yum -y install python-pip
已加载插件:fastestmirror, langpacks
epel/x86_64/metalink                                                                  | 5.6 kB  00:00:00     
epel                                                                                  | 4.3 kB  00:00:00     
(1/3): epel/x86_64/group_gz                                                           | 170 kB  00:00:00     
(2/3): epel/x86_64/updateinfo                                                         | 749 kB  00:00:04     
(3/3): epel/x86_64/primary_db                                                         | 4.6 MB  00:02:25     
Loading mirror speeds from cached hostfile
 * base: mirrors.btte.net
 * epel: mirrors.neusoft.edu.cn
 * extras: mirrors.btte.net
 * updates: mirrors.btte.net
正在解决依赖关系
--> 正在检查事务
---> 软件包 python2-pip.noarch.0.8.1.2-5.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

=============================================================================================================
 Package                     架构                   版本                          源                    大小
=============================================================================================================
正在安装:
 python2-pip                 noarch                 8.1.2-5.el7                   epel                 1.7 M

事务概要
=============================================================================================================
安装  1 软件包

总下载量:1.7 M
安装大小:7.2 M
Downloading packages:
警告:/var/cache/yum/x86_64/7/epel/packages/python2-pip-8.1.2-5.el7.noarch.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID 352c64e5: NOKEY
python2-pip-8.1.2-5.el7.noarch.rpm 的公钥尚未安装
python2-pip-8.1.2-5.el7.noarch.rpm                                                    | 1.7 MB  00:00:07     
从 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 检索密钥
导入 GPG key 0x352C64E5:
 用户ID     : "Fedora EPEL (7) <[email protected]>"
 指纹       : 91e9 7d7c 4a5e 96f1 7f3e 888f 6a2f aea2 352c 64e5
 软件包     : epel-release-7-9.noarch (@extras)
 来自       : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : python2-pip-8.1.2-5.el7.noarch                                                           1/1 
  验证中      : python2-pip-8.1.2-5.el7.noarch                                                           1/1 

已安装:
  python2-pip.noarch 0:8.1.2-5.el7                                                                           

完毕!

  然后来运行一下试试看:

[[email protected] magic]# 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.
  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.
  --log <path>                Path to a verbose appending log.
  --proxy <proxy>             Specify a proxy in the form [user:[email protected]]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.
  --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.
  --client-cert <path>        Path to SSL client certificate, a single file containing the private key and
                              the certificate in PEM format.
  --cache-dir <dir>           Store the cache data in <dir>.
  --no-cache-dir              Disable the cache.
  --disable-pip-version-check
                              Don't periodically check PyPI to determine whether a new version of pip is
                              available for download. Implied with --no-index.

PS:未经作者授权,谢绝转载!


文章来源: https://www.cnblogs.com/magic-zero/p/6512303.html
如有侵权请联系:admin#unsafe.sh