python
network_error
ai_generated
true
错误:由于 OSError 无法安装包:HTTPSConnectionPool(host='pypi.org', port=443):超过最大重试次数。原因:NewConnectionError,无法建立新连接:[Errno 111] 连接被拒绝。
ERROR: Could not install packages due to an OSError: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/ (Caused by NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object>: Failed to establish a new connection: [Errno 111] Connection refused'))
ID: python/pip-connection-refused-proxy
80%修复率
86%置信度
0证据数
2024-06-25首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 3.8 | active | — | — | — |
| 3.9 | active | — | — | — |
| 3.10 | active | — | — | — |
| 3.11 | active | — | — | — |
| 3.12 | active | — | — | — |
根因分析
pip 正在使用环境中的 HTTP(S) 代理(HTTP_PROXY/HTTPS_PROXY),但该代理不可达或拒绝连接。
English
pip is honoring an HTTP(S) proxy from the environment (HTTP_PROXY/HTTPS_PROXY) that is unreachable or refusing connections.
解决方案
-
90% 成功率
Unset or correct the proxy env vars: `unset HTTP_PROXY HTTPS_PROXY http_proxy https_proxy` then retry, or set `proxy = http://user:pass@host:port` in pip.conf.
-
85% 成功率
Bypass the proxy for PyPI: `pip install --proxy "" <pkg>` (empty string disables proxy for this invocation).
无效尝试
常见但无效的做法:
-
85% 失败
Retries cannot succeed against a proxy that consistently refuses connections.
-
90% 失败
Trusted-host skips TLS verification, not proxy routing; the connection still fails.