尝试使用 pip install Red Hat 安装软件包时出错

Posted

技术标签:

【中文标题】尝试使用 pip install Red Hat 安装软件包时出错【英文标题】:error when trying to install packages with pip install Red Hat 【发布时间】:2019-12-19 14:00:52 【问题描述】:

早上好,我正在尝试使用 pip install 安装软件包,在本例中是 docker-compose,我想将它安装在 Red Hat 8 中,我已经安装了 docker,但出现以下错误:

[dockermd@srvdevrma1 ~]$ sudo pip3 install docker-compose
WARNING: Running pip install with root privileges is generally not a good idea. Try pip3 install --user instead.
Collecting docker-compose
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f324ba08e10>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/docker-compose/
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f324ba08a20>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/docker-compose/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f324ba08cc0>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/docker-compose/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f324ba084a8>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/docker-compose/
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f324ba08630>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/docker-compose/
Could not find a version that satisfies the requirement docker-compose (from versions: )
No matching distribution found for docker-compose

我已经配置了代理和一切:

[dockermd@srvdevrma1 ~]$ env | grep proxy
https_proxy=https://E10697:xxxxxx++@10.162.64.36:8080
http_proxy=http://E10697:xxxxxx++@10.162.64.36:8080

您尝试使用 pip 安装的任何软件包都会发生这种情况

【问题讨论】:

【参考方案1】:

您需要为您sudo 的用户声明代理。 IMO 最简单的解决方案。

sudo -i
export http_proxy=https://E10697:xxxxxx++@10.162.64.36:8080
export https_proxy=https://E10697:xxxxxx++@10.162.64.36:8080
pip3 install docker-compose
exit

【讨论】:

以上是关于尝试使用 pip install Red Hat 安装软件包时出错的主要内容,如果未能解决你的问题,请参考以下文章

Installing Lumen -- Red Hat/CentOS

Red Hat Enterprise 8.5 Install

Linux red hat 安装ansible

Red Hat Enterprise 8.5 Install

Red Hat Enterprise 9.0 Beta Install

Red Hat Enterprise Linux 8 Install Redis