# 错误：/etc/pip.conf 中的配置文件无效：预期节标题但找到 'global'

- **ID:** `python/pip-config-file-parse-error`
- **领域:** python
- **类别:** config_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

pip 配置文件存在错误的 INI 语法，通常是因为节名称缺少方括号或存在多余缩进。

## 版本兼容性

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

## 解决方案

1. **** (95% 成功率)
   ```
   Ensure sections look like `[global]` and keys like `index-url = https://pypi.org/simple`; validate with `python -c "import configparser; c=configparser.ConfigParser(); c.read('/etc/pip.conf')"`
   ```
2. **** (90% 成功率)
   ```
   pip config list -v
   ```

## 无效尝试

- **** — Loses intentional settings such as corporate index URLs and trusted hosts. (50% 失败率)
- **** — Ignores all pip configuration, including required mirrors and certs. (60% 失败率)
- **** — Isolated mode ignores user config but still parses the system config file. (70% 失败率)
