python install_error ai_generated true

错误:无效命令 'bdist_wheel' 错误:为 foo 构建 wheel 失败

error: invalid command 'bdist_wheel' ERROR: Failed building wheel for foo

ID: python/setuptools-command-not-found-in-setup-py

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

版本兼容性

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

根因分析

构建环境中未安装 `wheel` 包,因此 setuptools 不知道 bdist_wheel 命令。

English

The `wheel` package is not installed in the build environment, so setuptools does not know the bdist_wheel command.

generic

解决方案

  1. 95% 成功率
    Install wheel into the build environment:
      pip install --upgrade setuptools wheel
      pip install foo
    If using build isolation, ensure your pyproject.toml [build-system] requires includes 'wheel'.
  2. 90% 成功率
    For legacy setup.py projects, add to pyproject.toml:
      [build-system]
      requires = ["setuptools>=61", "wheel"]
      build-backend = "setuptools.build_meta"

无效尝试

常见但无效的做法:

  1. 85% 失败

    setuptools alone does not provide bdist_wheel; the wheel package is a separate distribution.

  2. 80% 失败

    Forces source build, which still needs wheel to produce a wheel; same error.