# ModuleNotFoundError：没有名为 'pip' 的模块

- **ID:** `python/pip-venv-pip-missing-after-ensurepip`
- **领域:** python
- **类别:** install_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

venv 以 `--without-pip` 创建，或 ensurepip 静默失败，导致环境未安装 pip。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.8 | active | — | — |
| 3.9 | active | — | — |
| 3.10 | active | — | — |
| 3.11 | active | — | — |
| 3.12 | active | — | — |

## 解决方案

1. **** (90% 成功率)
   ```
   Bootstrap pip via get-pip.py: `curl -sS https://bootstrap.pypa.io/get-pip.py | python`.
   ```
2. **** (95% 成功率)
   ```
   Recreate the venv without --without-pip: `rm -rf .venv && python -m venv .venv`.
   ```

## 无效尝试

- **** — On some distros (Debian/Ubuntu) ensurepip is disabled and prints a message suggesting apt install python3-pip instead. (60% 失败率)
- **** — pip is the module being invoked; the command cannot run before pip exists. (95% 失败率)
