# 错误：无法为 mypackage 构建 wheel，这是安装基于 pyproject.toml 的项目所必需的

  错误：无效命令 'bdist_wheel'

  错误：为 mypackage 构建 wheel 失败

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

## 根因

项目的 pyproject.toml 中的 build-system.requires 未包含 'wheel'，而旧版构建后端（setuptools.build_meta:__legacy__）在没有它的情况下无法构建 wheel。

## 版本兼容性

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

## 解决方案

1. **** (98% 成功率)
   ```
   [build-system]\nrequires = ["setuptools>=61", "wheel"]\nbuild-backend = "setuptools.build_meta"
   ```
2. **** (90% 成功率)
   ```
   pip install --upgrade setuptools wheel && pip install mypackage
   ```

## 无效尝试

- **** — Forces source build, which still needs wheel to produce the artifact for installation. (85% 失败率)
- **** — Uses the ambient environment's setuptools, which may also lack wheel. (60% 失败率)
