python
config_error
ai_generated
true
已满足要求:foo 位于 /usr/lib/python3/dist-packages (1.0.0),但您已安装 foo 2.0.0
Requirement already satisfied: foo in /usr/lib/python3/dist-packages (1.0.0), but you have foo 2.0.0
ID: python/pip-requirement-already-satisfied-wrong-version
80%修复率
84%置信度
0证据数
2024-07-22首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 3.x | active | — | — | — |
根因分析
sys.path 上存在多个 site-packages 位置;pip 看到的是一个已安装副本,而另一个副本将其遮蔽。
English
Multiple site-packages locations on sys.path; pip sees one installed copy while another shadows it.
解决方案
-
95% 成功率
python -m venv .venv source .venv/bin/activate pip install foo
-
75% 成功率
python -c "import sys; print('\n'.join(sys.path))" python -m pip install --target=/custom/path foo
无效尝试
常见但无效的做法:
-
60% 失败
Reinstalls into one location while the shadowing copy remains, so the wrong version still imports.
-
80% 失败
Removing system packages can break OS tooling and is often not permitted.