【发布时间】:2021-02-03 07:58:47
【问题描述】:
我在新安装的 CentOS 7 (7.9.2009) 服务器中使用 pip 安装库时遇到问题。
我安装了 python 3.8.3 并立即将 pip 升级到最新版本 21.0.1。
已经导出了我的http_proxy 和https_proxy settings,
http_proxy=http://<creds>@10.XXX.XX.XX:XXX
https_proxy=https://<creds>@10.XXX.XX.XX:XXX
但是当我尝试通过 pip 安装库时,我得到了这个错误。
[root@localhost downloads]# pip3.8 install pandas --proxy https://user:pwd@10.XXX.XXX.XXX:808
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', timeout('_ssl.c:1091: The handshake operation timed out'))': /simple/pandas/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', timeout('_ssl.c:1091: The handshake operation timed out'))': /simple/pandas/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', timeout('_ssl.c:1091: The handshake operation timed out'))': /simple/pandas/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', timeout('_ssl.c:1091: The handshake operation timed out'))': /simple/pandas/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', timeout('_ssl.c:1091: The handshake operation timed out'))': /simple/pandas/
ERROR: Could not find a version that satisfies the requirement pandas
ERROR: No matching distribution found for pandas
我尝试了详细模式来检查。
如果我可以访问它,我尝试通过 curl 检查它,是的,我可以。
[root@localhost downloads]# curl -I https://pypi.org/simple/pandas/
HTTP/1.1 200 Connection established
Proxy-agent: CCProxy
HTTP/1.1 200 OK
Connection: keep-alive
Content-Length: 381742
Cache-Control: max-age=600, public
Content-Security-Policy: default-src 'none'; sandbox allow-top-navigation
Content-Type: text/html; charset=UTF-8
ETag: "zPB5FsC5JkZZm1ZnKHnuUw"
Referrer-Policy: origin-when-cross-origin
Server: nginx/1.13.9
X-PyPI-Last-Serial: 9182431
Accept-Ranges: bytes
Date: Wed, 03 Feb 2021 07:44:51 GMT
X-Served-By: cache-bwi5146-BWI, cache-sin18034-SIN
X-Cache: HIT, HIT
X-Cache-Hits: 1, 1
X-Timer: S1612338291.161041,VS0,VE1
Vary: Accept-Encoding, Accept-Encoding
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
X-Frame-Options: deny
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
X-Permitted-Cross-Domain-Policies: none
我还尝试wget上述存储库中最新的pandas文件,我能够下载它。
[root@localhost downloads]# wget https://files.pythonhosted.org/packages/11/1c/b0bc154996617eae877ff267fcf84e55e6c6808dbade0da206f0419dd483/pandas-1.2.1.tar.gz#sha256=5527c5475d955c0bc9689c56865aaa2a7b13c504d6c44f0aadbf57b565af5ebd
--2021-02-03 10:47:24-- https://files.pythonhosted.org/packages/11/1c/b0bc154996617eae877ff267fcf84e55e6c6808dbade0da206f0419dd483/pandas-1.2.1.tar.gz
Connecting to 10.XXX.XXX.XXX:808... connected.
Proxy request sent, awaiting response... 200 OK
Length: 5459053 (5.2M) [application/x-tar]
Saving to: ‘pandas-1.2.1.tar.gz’
100%[============================================================================================>] 5,459,053 418KB/s in 13s
2021-02-03 10:47:39 (399 KB/s) - ‘pandas-1.2.1.tar.gz’ saved [5459053/5459053]
我在这里遗漏了什么吗?我正在考虑导致这种情况的服务器设置。还是只是代理不工作?
【问题讨论】:
-
错误显示您的代理服务器有问题。你为什么用它?您导出了哪些设置?
-
http_proxy=http://
@10.XXX.XX.XX:XXX https_proxy=https:// @10.XXX.XX.XX:XXX -
真的是代理吗?但是,如果我的 curl 和 wget 是代理,为什么它会通过呢?
-
错误显示
'Cannot connect to proxy所以问题导致proxy。您是否尝试将pip代理与http一起使用而不是https?--proxy http://....。而在wget、curl中,您没有设置手动代理,但他们从http_proxy或https_proxy中进行选择,而您不知道他们使用的是哪一个。 -
质疑代理设置 - 更多人会看到它。
标签: python python-3.x pip centos7