python install_error ai_generated true

错误:无效命令 'bdist_wheel'

error: invalid command 'bdist_wheel'

ID: python/setup-py-invalid-command-bdist-wheel

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

版本兼容性

版本状态引入弃用备注
3.x active — — —

根因分析

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

English

Building a wheel with `python setup.py bdist_wheel` or `pip install` from sdist requires the `wheel` package. It is missing from the build environment, so setuptools does not register the bdist_wheel command.

generic

解决方案

  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

无效尝试

常见但无效的做法:

  1. 80% 失败

    Bypasses wheel building but is deprecated, pollutes the environment, and is not reproducible. Many modern packages refuse setup.py install.

  2. 85% 失败

    Version mismatches and missing entry points cause later failures; setuptools may still not discover the command.