# 错误：无效命令 'bdist_wheel'

- **ID:** `python/setup-py-invalid-command-bdist-wheel`
- **领域:** python
- **类别:** install_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

使用 `python setup.py bdist_wheel` 或从 sdist 执行 `pip install` 构建 wheel 时需要 `wheel` 包。构建环境中缺少它，setuptools 未注册 bdist_wheel 命令。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.x | active | — | — |

## 解决方案

1. **** (95% 成功率)
   ```
   python -m pip install --upgrade wheel setuptools
python setup.py bdist_wheel
# or build via pip which handles build deps:
python -m pip wheel . -w dist
   ```
2. **** (90% 成功率)
   ```
   # pyproject.toml
[build-system]
requires = ["setuptools>=68", "wheel"]
build-backend = "setuptools.build_meta"
# then
python -m build
   ```

## 无效尝试

- **** — Bypasses wheel building but is deprecated, pollutes the environment, and is not reproducible. Many modern packages refuse setup.py install. (80% 失败率)
- **** — Version mismatches and missing entry points cause later failures; setuptools may still not discover the command. (85% 失败率)
