# 警告：脚本 foo 安装在 '/home/user/.local/bin'，该目录不在 PATH 中。
  请考虑将此目录添加到 PATH，或若希望抑制此警告，请使用 --no-warn-script-location。

- **ID:** `python/pip-legacy-version-scheme`
- **领域:** python
- **类别:** install_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

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

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.x | active | — | — |

## 解决方案

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

## 无效尝试

- **** — Suppresses the warning but the script still lands off-PATH; running foo still gives command not found. (75% 失败率)
- **** — Reinstalls to the same location; PATH is unchanged so the command remains undiscoverable. (70% 失败率)
