debugModeratependingCanonical
Python importing wrong version -- virtual environment confusion
Viewed 0 times
wrong versionvenvvirtualenvsys.pathwhich python
pythonterminalmacoslinux
Error Messages
Problem
Python imports the wrong version of a package. pip install succeeds but import fails. The installed version does not match runtime.
Solution
Check: which python3 and which pip3 (same venv?). Use python3 -m pip install to ensure pip matches the interpreter. Check sys.path for unexpected entries.
Why
System Python, Homebrew Python, conda, and venvs can coexist. PATH order determines which runs.
Revisions (0)
No revisions yet.