python install_error ai_generated true

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

error: invalid command 'bdist_wheel' ERROR: Failed building wheel for foo ERROR: Could not build wheels for foo, which is required to install pyproject.toml-based projects

ID: python/pip-missing-wheel-bdist-build

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

版本兼容性

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

根因分析

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

English

The 'wheel' package is not installed in the build environment, so setuptools lacks the bdist_wheel command needed to produce a wheel. Common with --no-build-isolation or old build configs.

generic

解决方案

  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"

无效尝试

常见但无效的做法:

  1. 60% 失败

    If wheel is absent in the current env, bdist_wheel is still missing.

  2. 85% 失败

    pip version is unrelated to the missing wheel build backend command.