CentOS7安装python-pip

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:00
从 file:///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:未经作者授权,谢绝转载!

时间: 2024-10-25 11:26:00

CentOS7安装python-pip的相关文章

mac下安装python pip、pyspider

如果mac下没有安装wget,还需要安装wget,见http://www.cnblogs.com/cocowool/archive/2012/06/24/2560574.html 使用 pip 安装 Python 库.pip 是 Python 的包管理工具,安装后就可以直接在命令行一站式地安装/管理各种库了(pip 文档). $ wget http://pypi.python.org/packages/source/p/pip/pip-0.7.2.tar.gz$ tar xzf pip-0.7.

Linux下安装Python pip

在Python环境下,pip提供类似yum一样的下载方式,比easy_install方便的多. 1.下载get-pip.py wget https://bootstrap.pypa.io/get-pip.py 2.安装 python get-pip.py 3.查看安装位置 find / -name pip 默认安装在Python安装目录,/usr/local/python/bin/pip 4.使用pip下载包psutil /usr/local/python/bin/pip install psu

安装Python, Pip, Virtualenv

1.安装deb包#apt-get -y update#apt-get -y upgrade#apt-get -y install build-essential /这个包可以批量安装Python在Ubuntu上进行构建时所需的全部工具(gcc, make.etc) 安装python相关的包#apt-get -y install python-dev 3.安装新版本的pip#wget https://bootstrap.pypa.io/get-pip.py#python get-pip.py 查看

centos7安装python 与卸载python

安装python 下载Python安装包 1 cd /usr/local/src 编译时要提前装好gcc编译器和zlib zlib-devel 1.下载文件 1 wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz 2.解压 1 tar -zxvf Python-3.6.0.tgz 3.进入解压目录 1 cd Python-3.6.0 4.编译安装包 1 2 3 ./configure --prefix=/usr/local/

CentOS-7安装python虚拟环境

安装虚拟环境的前提是你需要CentOS安装python解释器. 1. 安装虚拟环境模块 pip3 install virtualenv -i https://mirrors.aliyun.com/pypi/simple/ 2. 安装virtualenvwrapper 工具管理虚拟环境 pip3 install virtualenvwrapper -i https://mirrors.aliyun.com/pypi/simple/ 3. 创建虚拟环境(.virtualenvs)文件夹 mkdir

CentOS7 安装python库(numpy、scipy、matplotlib、scikit-learn、tensorflow)

0.1准备工作 安装好CentOS7,配置好网络,确保网络畅通. 0.2root授权 首先:当前用户为kaid # vim /etc/sudoers 在root ALL=(ALL) ALL之后添加: kaid ALL=(ALL) NOPASSWD:ALL 表示,用户kaid可以不需要验证密码而执行root的所有操作(为了安全起见,安装后,改回来哦). 0.3安装git $ sudo yum -y install git 0.4 安装vimplus $ git clone https://gith

windows下安装python&amp;pip

1.在https://www.python.org/downloads/下载相应的python安装包, 解压安装,配置环境变量. 2.下载pip安装包:https://pypi.python.org/pypi/pip#downloads 1)解压到目录:在cmd命令行执行:python setup.py install 2)配置python目录下的scripts到环境变量.

Centos7 安装python环境

保留python2 找到python所在位置,把python指向python2.7备份 [[email protected] /usr/bin]# cd ~ [[email protected] ~]# whereis python python: /usr/bin/python /usr/bin/python2.7 /usr/lib/python2.7 /usr/lib64/python2.7 /etc/python /usr/include/python2.7 /usr/share/man/

centos7 安装python虚拟环境

本篇主要介绍centos7系统下,安装python3虚拟环境.环境:系统centos7,源代码安装python3,/usr/bin/python3为自己安装的. 安装支持包 yum install python-virtualenv -ypip3 install virtualenvwrapper12修改系统环境变量.编辑root目录下的 ‘.bashrc’ 文件 vim /root/.bashrc1打开.bashrc文件添加内容如下: VIRTUALENVWRAPPER_PYTHON=/usr

centos7部署pyenv安装python多版本

在CentOS7通过pyenv安装Python3和virtualenv CentOS中默认安装Python版本是2.7版.我们将一步步在CentOS服务器上的安装Python3. 由于CentOS系统内很多工具都依赖于系统自带的Python2.7.5,所以为了不影响Python2.7.5的使用,就使用Pyenv进行环境隔离.virtualenv用来为每个python应用都创建一个独立的python环境. Step 1.更新系统 $ sudo yum -y update Step 2. 安装依赖环