我正在尝试在 centos7 docker 容器中安装 python-pip,但我想我可能缺少一些包或其他东西。
[root@aasdfasdfa /]# yum -y install python-pip
Loaded plugins: fastestmirror, ovl
base | 3.6 kB 00:00:00
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00
updates/7/x86_64/primary_db | 8.4 MB 00:00:31
Loading mirror speeds from cached hostfile
* base: repos.lax.quadranet.com
* extras: mirrors.unifiedlayer.com
* updates: mirrors.usc.edu
No package python-pip available.
Error: Nothing to do
我需要先运行什么yum -y install python-pip
才能正确安装。请注意,它easy_install
也坏了,所以这不是一个选项。
答案1
您必须启用 EPEL repo,使用:
yum --enablerepo=extras install epel-release
此命令将为您正在运行的 CentOS 版本安装正确的 EPEL 存储库。
此后您将能够安装 python-pip。
答案2
我对同样的问题感到很恼火。yum 找不到 python-pip 的原因是它不再称为 python-pip。从 EPEL 版本 7 开始,它被重命名以识别 python 版本。在我的 centOS 机器上,我现在可以找到以下 python*-pip 包。
[root@asdasdasdasdsa ~]# yum info python*-pip
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: ftp.rz.uni-frankfurt.de
* epel: mirrors.mit.edu
* extras: mirror.23media.de
* updates: ftp.plusline.de
Available Packages
Name : python2-pip
Arch : noarch
Version : 8.1.2
Release : 5.el7
Size : 1.7 M
Repo : epel/x86_64
Summary : A tool for installing and managing Python 2 packages
URL : http://www.pip-installer.org
License : MIT
Description : Pip is a replacement for `easy_install
: <http://peak.telecommunity.com/DevCenter/EasyInstall>`_. It uses mostly the
: same techniques for finding packages, so packages that were made
: easy_installable should be pip-installable as well.
Name : python34-pip
Arch : noarch
Version : 8.1.2
Release : 5.el7
Size : 1.7 M
Repo : epel/x86_64
Summary : A tool for installing and managing Python3 packages
URL : http://www.pip-installer.org
License : MIT
Description : Pip is a replacement for `easy_install
: <http://peak.telecommunity.com/DevCenter/EasyInstall>`_. It uses mostly the
: same techniques for finding packages, so packages that were made
: easy_installable should be pip-installable as well.
答案3
CentOS Docker 镜像默认不包含 EPEL 存储库,而常规 CentOS 安装则包含。yum install epel-release
首先您应该这样做 — — 然后,yum install python-pip
应该就可以正常工作了。
答案4
如果安装 epel repo 后仍然出现同样的错误,请尝试:
sudo yum install -y --enablerepo="epel" python-pip