# 错误：无效的配置文件：/home/user/.config/pip/pip.conf
  TOMLDecodeError：键值对中键后应有 '='（第 3 行，第 4 列）

- **ID:** `python/pip-pip-conf-invalid-toml`
- **领域:** python
- **类别:** config_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

pip.conf（或 pip.toml）包含格式错误的 TOML/INI——缺少 '='、多余的引号，或混合了 INI 和 TOML 语法。pip 拒绝读取任何配置，所有 pip 命令都失败。

## 版本兼容性

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

## 解决方案

1. **** (95% 成功率)
   ```
   # ~/.config/pip/pip.conf
[global]
index-url = https://pypi.org/simple
timeout = 60
   ```
2. **** (90% 成功率)
   ```
   python -c "import tomllib; tomllib.load(open('/home/user/.config/pip/pip.conf','rb'))"
   ```
3. **** (85% 成功率)
   ```
   PIP_CONFIG_FILE=/dev/null pip install <pkg>
   ```

## 无效尝试

- **** — pip can't read its config to start. (95% 失败率)
- **** — Config parsing happens before cache logic. (90% 失败率)
- **** — The malformed config file is still parsed and errors. (85% 失败率)
