python
config_error
ai_generated
true
Requirement already satisfied: numpy in /usr/lib/python3/dist-packages (1.21.5) but you have python 3.11 and numpy is not importable
ID: python/pip-requirement-already-satisfied-wrong-python
80%Fix Rate
87%Confidence
0Evidence
2024-07-04First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3.9 | active | — | — | — |
| 3.10 | active | — | — | — |
| 3.11 | active | — | — | — |
| 3.12 | active | — | — | — |
Root Cause
pip is resolving against a dist-packages directory for a different Python version. Usually caused by a mismatched pip (e.g. pip points to system Python while you run a pyenv Python), or PYTHONPATH leaking.
generic中文
pip 正在针对不同 Python 版本的 dist-packages 目录进行解析。通常由 pip 与 Python 不匹配(例如 pip 指向系统 Python,而你运行的是 pyenv Python),或 PYTHONPATH 泄漏引起。
Workarounds
-
98% success
python3.11 -m pip install numpy
-
95% success
which -a pip python && pip -V && python -V
-
98% success
python3.11 -m venv .venv && source .venv/bin/activate && pip install numpy
Dead Ends
Common approaches that don't work:
-
85% fail
Still installs into the wrong interpreter's site-packages.
-
95% fail
Makes things worse by mixing ABI-incompatible C extensions.