python
network_error
ai_generated
partial
错误:pip._vendor.urllib3.exceptions.ProtocolError:('连接中止。',ConnectionResetError(104, '对端重置连接'))
ERROR: pip._vendor.urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
ID: python/pip-connection-reset-by-peer
80%修复率
85%置信度
0证据数
2025-10-05首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 3.8 | active | — | — | — |
| 3.9 | active | — | — | — |
根因分析
远程服务器强制关闭 TCP 连接,通常由于防火墙、超时或服务器过载。
English
The remote server forcefully closed the TCP connection, often due to firewall, timeout, or server overload.
解决方案
-
70% 成功率 Use a retry mechanism with pip's --retries option
Run: pip install --retries 5 package
-
80% 成功率 Use a different network or proxy
Run: pip install --proxy http://proxy:port package
无效尝试
常见但无效的做法:
-
Increasing pip's timeout with --default-timeout
80% 失败
The connection is reset, not timed out; timeout increase doesn't help.
-
Using a VPN to change IP
60% 失败
May bypass some firewalls but not all; also adds latency.