# 错误：403 客户端错误：禁止访问 url：https://private-pypi.example.com/simple/mypackage/

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

## 根因

额外的索引 URL 需要身份验证或从当前网络无法访问。

## 版本兼容性

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

## 解决方案

1. **Provide credentials in the index URL** (85% 成功率)
   ```
   pip install --extra-index-url https://username:password@private-pypi.example.com/simple mypackage
   ```
2. **Use a .netrc file for authentication** (90% 成功率)
   ```
   echo 'machine private-pypi.example.com login username password password' >> ~/.netrc && chmod 600 ~/.netrc
   ```

## 无效尝试

- **Using --trusted-host without credentials** — Trusted-host only bypasses SSL verification, not authentication. (80% 失败率)
- **Adding the URL to pip.conf without credentials** — pip still needs authentication for private repositories. (70% 失败率)
