python module_error ai_generated true

/usr/bin/python3:没有名为 pip 的模块

/usr/bin/python3: No module named pip

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

其他格式: JSON · Markdown 中文 · English
80%修复率
89%置信度
0证据数
2024-02-28首次发现

版本兼容性

版本状态引入弃用备注
3.8 active — — —
3.9 active — — —
3.10 active — — —
3.11 active — — —
3.12 active — — —

根因分析

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

English

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

解决方案

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

无效尝试

常见但无效的做法:

  1. 95% 失败

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

  2. 90% 失败

    pip isn't present anywhere on disk.

  3. 70% 失败

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