python install_error ai_generated true

WARNING: The script foo is installed in '/home/user/.local/bin' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

ID: python/pip-legacy-version-scheme

Also available as: JSON · Markdown · 中文
80%Fix Rate
83%Confidence
0Evidence
2024-08-21First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.x active — — —

Root Cause

pip installed console_scripts into the user site bin directory (because of --user or a non-activated venv), but that directory is not on the shell's PATH, so the command isn't found.

generic

中文

由于使用了 --user 或未激活的 venv,pip 将 console_scripts 安装到用户 site bin 目录,但该目录不在 shell 的 PATH 中,因此找不到命令。

Workarounds

  1. 90% success
    Add the dir to PATH: export PATH="$HOME/.local/bin:$PATH"  # append to ~/.bashrc or ~/.zshrc to persist
  2. 88% success
    Use a venv so scripts install into the active env: python -m venv .venv && . .venv/bin/activate && pip install foo

Dead Ends

Common approaches that don't work:

  1. 75% fail

    Suppresses the warning but the script still lands off-PATH; running foo still gives command not found.

  2. 70% fail

    Reinstalls to the same location; PATH is unchanged so the command remains undiscoverable.