ERROR
pip
config_error
ai_generated
true
错误:pip.conf 文件中不允许使用选项 '--trusted-host'。请使用格式:trusted-host = pypi.org files.pythonhosted.org
ERROR: Option '--trusted-host' is not allowed in the pip.conf file. Use the format: trusted-host = pypi.org files.pythonhosted.org
ID: pip/pip-conf-option-error
95%修复率
90%置信度
1证据数
2023-04-10首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| pip 22.3 | active | — | — | — |
| pip 23.0 | active | — | — | — |
| pip 23.2 | active | — | — | — |
根因分析
pip 配置文件(pip.conf/pip.ini)包含命令行样式的选项(如 --trusted-host),而不是正确的 INI 风格键值对格式。
English
The pip configuration file (pip.conf/pip.ini) contains command-line-style options (e.g., --trusted-host) instead of the correct INI-style key-value format.
官方文档
https://pip.pypa.io/en/stable/topics/configuration/解决方案
-
Edit pip.conf to use correct INI format: [global] trusted-host = pypi.org files.pythonhosted.org
-
Remove the offending lines and use environment variables instead: export PIP_TRUSTED_HOST="pypi.org files.pythonhosted.org"
-
Validate config with: pip config list --global (or --user/--site) to see current effective settings.
无效尝试
常见但无效的做法:
-
70% 失败
This works temporarily but does not fix the config file; the error persists on next pip command reading the config.
-
90% 失败
Still uses the CLI-style prefix; config expects bare key names without dashes.
-
50% 失败
Removes the error but also removes all other valid configurations, potentially breaking other settings.