# 错误：无效命令 'bdist_wheel'。错误：为 foo 构建 wheel 失败。错误：无法为 foo 构建 wheel，这是安装基于 pyproject.toml 的项目所必需的。

- **ID:** `python/pip-missing-wheel-bdist-build`
- **领域:** python
- **类别:** install_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

构建环境中未安装 'wheel' 包，因此 setuptools 缺少生成 wheel 所需的 bdist_wheel 命令。常见于 --no-build-isolation 或旧构建配置。

## 版本兼容性

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

## 解决方案

1. **** (93% 成功率)
   ```
   python -m pip install --upgrade pip setuptools wheel
pip install foo
   ```
2. **** (90% 成功率)
   ```
   # pyproject.toml
[build-system]
requires = ["setuptools>=61", "wheel"]
build-backend = "setuptools.build_meta"
   ```

## 无效尝试

- **** — If wheel is absent in the current env, bdist_wheel is still missing. (60% 失败率)
- **** — pip version is unrelated to the missing wheel build backend command. (85% 失败率)
