python install_error ai_generated true

SetuptoolsDeprecationWarning:setup.py install 已弃用。请使用 build 和 pip 及其他基于标准的工具。

SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.

ID: python/setup-py-deprecated-invoke-setup

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

版本兼容性

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

根因分析

运行 `python setup.py install`(或 `python setup.py develop`)会调用 setuptools 已弃用的旧代码路径,官方推荐使用 PEP 517/518 构建前端(如 pip)。

English

Running `python setup.py install` (or `python setup.py develop`) invokes a legacy code path that setuptools has deprecated in favor of PEP 517/518 build frontends like pip.

generic

解决方案

  1. 95% 成功率
    Use pip: pip install . (pip invokes the PEP 517 build backend automatically)
  2. 93% 成功率
    Build a wheel first: python -m build && pip install dist/*.whl
  3. 94% 成功率
    For editable installs: pip install -e .

无效尝试

常见但无效的做法:

  1. 70% 失败

    Suppresses the message but leaves the deprecated install path; future setuptools versions will remove it and break the build.

  2. 75% 失败

    Pinning to an old setuptools breaks compatibility with modern pyproject.toml-based projects and other dependencies.

  3. 80% 失败

    The --user flag does not change the deprecated code path; the warning persists and the install may still fail on modern Python.