python module_error ai_generated true

/usr/bin/python3: No module named pip

ID: python/pip-module-not-found-no-module-named-pip

Also available as: JSON · Markdown · 中文
80%Fix Rate
89%Confidence
0Evidence
2024-02-28First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.8 active — — —
3.9 active — — —
3.10 active — — —
3.11 active — — —
3.12 active — — —

Root Cause

The interpreter has no pip installed (common on minimal Debian/Ubuntu images where python3-pip is a separate package, or a freshly built/embedded Python without ensurepip).

generic

中文

该解释器未安装 pip(常见于精简的 Debian/Ubuntu 镜像中 python3-pip 是单独包,或新编译/嵌入式 Python 未包含 ensurepip)。

Workarounds

  1. 85% success
    python3 -m ensurepip --upgrade
    python3 -m pip install --upgrade pip
  2. 90% success
    sudo apt-get install -y python3-pip  # Debian/Ubuntu
    # or
    sudo dnf install -y python3-pip
  3. 80% success
    curl -sS https://bootstrap.pypa.io/get-pip.py -o get-pip.py
    python3 get-pip.py

Dead Ends

Common approaches that don't work:

  1. 95% fail

    pip isn't installed, so the command itself fails.

  2. 90% fail

    pip isn't present anywhere on disk.

  3. 70% fail

    Only works if that interpreter has pip; the target one still doesn't.