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/setuptools-deprecated-use-of-setup-py

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

版本兼容性

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

根因分析

用户调用了 `python setup.py install`(或调用它的工具),而不是使用 pip/build。现代 setuptools 会告警,并最终移除该路径。

English

The user invoked `python setup.py install` (or a tool that does) instead of using pip/build. Modern setuptools warns and will eventually remove this path.

generic

解决方案

  1. 95% 成功率
    Replace `python setup.py install` with:
      python -m pip install .
    For editable installs:
      python -m pip install -e .
    For building distributions:
      python -m build
  2. 85% 成功率
    If you maintain the package, migrate metadata from setup.py to pyproject.toml [project] table and keep setup.py only as a shim.

无效尝试

常见但无效的做法:

  1. 70% 失败

    Hides the symptom but the legacy path is still used and will break in future setuptools releases.

  2. 85% 失败

    Downgrading setuptools breaks other packages that require modern setuptools for PEP 517/518 builds.