python
install_error
ai_generated
true
/path/to/venv/bin/python: No module named pip
ID: python/pip-venv-no-pip
80%Fix Rate
89%Confidence
0Evidence
2024-11-28First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3.8 | active | — | — | — |
| 3.9 | active | — | — | — |
| 3.10 | active | — | — | — |
| 3.11 | active | — | — | — |
| 3.12 | active | — | — | — |
Root Cause
A virtual environment was created without pip (e.g. python -m venv --without-pip, or a broken ensurepip), so pip is unavailable inside it.
generic中文
创建虚拟环境时未包含 pip(例如 python -m venv --without-pip,或 ensurepip 损坏),因此环境内无法使用 pip。
Workarounds
-
95% success
source /path/to/venv/bin/activate python -m ensurepip --upgrade python -m pip install --upgrade pip
-
98% success
deactivate || true rm -rf /path/to/venv python -m venv /path/to/venv source /path/to/venv/bin/activate python -m pip --version
Dead Ends
Common approaches that don't work:
-
95% fail
pip is not importable inside the venv, so the command itself fails before it can install anything.
-
90% fail
Installs pip for the system Python, not for the broken virtual environment.