# 警告：连接因 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x...>: Failed to establish a new connection: [Errno 111] Connection refused')' 中断，正在重试（Retry(total=4, connect=None, read=None, redirect=None, status=None)）

- **ID:** `python/pip-extra-index-unreachable`
- **领域:** python
- **类别:** network_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

pip 配置了一个在当前网络上无法访问的额外索引 URL，导致在回退前反复重试。

## 版本兼容性

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

## 解决方案

1. **** (90% 成功率)
   ```
   pip config unset global.extra-index-url  # or edit ~/.config/pip/pip.conf
   ```
2. **** (85% 成功率)
   ```
   pip install --index-url https://pypi.org/simple <package>
   ```

## 无效尝试

- **** — More retries just delay the same connection failure. (90% 失败率)
- **** — The connection is refused immediately; timeout is not the issue. (95% 失败率)
- **** — pip itself is fine; the configured index URL is the problem. (90% 失败率)
