# 错误：pip._vendor.urllib3.exceptions.ProtocolError：（'连接中止。'，ConnectionResetError(104, '对端重置连接')）

- **ID:** `python/pip-connection-reset-by-peer`
- **领域:** python
- **类别:** network_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

远程服务器强制关闭 TCP 连接，通常由于防火墙、超时或服务器过载。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.8 | active | — | — |
| 3.9 | active | — | — |

## 解决方案

1. **Use a retry mechanism with pip's --retries option** (70% 成功率)
   ```
   Run: pip install --retries 5 package
   ```
2. **Use a different network or proxy** (80% 成功率)
   ```
   Run: pip install --proxy http://proxy:port package
   ```

## 无效尝试

- **Increasing pip's timeout with --default-timeout** — The connection is reset, not timed out; timeout increase doesn't help. (80% 失败率)
- **Using a VPN to change IP** — May bypass some firewalls but not all; also adds latency. (60% 失败率)
