python
config_error
ai_generated
true
错误:无效的配置文件:/home/user/.config/pip/pip.conf TOMLDecodeError:键值对中键后应有 '='(第 3 行,第 4 列)
ERROR: Invalid config file: /home/user/.config/pip/pip.conf TOMLDecodeError: Expected '=' after a key in a key/value pair (at line 3, column 4)
ID: python/pip-pip-conf-invalid-toml
80%修复率
85%置信度
0证据数
2024-09-27首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 3.9 | active | — | — | — |
| 3.10 | active | — | — | — |
| 3.11 | active | — | — | — |
| 3.12 | active | — | — | — |
根因分析
pip.conf(或 pip.toml)包含格式错误的 TOML/INI——缺少 '='、多余的引号,或混合了 INI 和 TOML 语法。pip 拒绝读取任何配置,所有 pip 命令都失败。
English
pip.conf (or pip.toml) contains malformed TOML/INI — a missing '=', a stray quote, or mixing INI and TOML syntax. pip refuses to read any config, so every pip command fails.
解决方案
-
95% 成功率
# ~/.config/pip/pip.conf [global] index-url = https://pypi.org/simple timeout = 60
-
90% 成功率
python -c "import tomllib; tomllib.load(open('/home/user/.config/pip/pip.conf','rb'))" -
85% 成功率
PIP_CONFIG_FILE=/dev/null pip install <pkg>
无效尝试
常见但无效的做法:
-
95% 失败
pip can't read its config to start.
-
90% 失败
Config parsing happens before cache logic.
-
85% 失败
The malformed config file is still parsed and errors.