python
config_error
ai_generated
true
警告:脚本 somecli 已安装到 '/home/user/.local/bin',但该路径不在 PATH 中。
WARNING: The script somecli is installed in '/home/user/.local/bin' which is not on PATH.
ID: python/pip-install-scripts-not-on-path
80%修复率
88%置信度
0证据数
2025-04-11首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 3.8 | active | — | — | — |
| 3.9 | active | — | — | — |
| 3.10 | active | — | — | — |
| 3.11 | active | — | — | — |
| 3.12 | active | — | — | — |
根因分析
pip 将控制台脚本安装到了用户级 bin 目录,而该目录未包含在 shell 的 PATH 中。
English
pip installed the console script into a user-level bin directory that is not included in the shell's PATH.
解决方案
-
95% 成功率
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc && source ~/.bashrc
-
90% 成功率
python -m venv .venv && source .venv/bin/activate && pip install somecli
无效尝试
常见但无效的做法:
-
80% 失败
Installs to system paths and can break the user environment; also creates root-owned files.
-
95% 失败
Path configuration is unrelated to reinstall behavior.
-
60% 失败
Only works if the package exposes a `__main__` module; many CLI packages do not.