
我正在嘗試在 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 儲存庫,使用:
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 儲存庫後仍出現相同的錯誤,請嘗試:
sudo yum install -y --enablerepo="epel" python-pip