python install_error ai_generated true

弃用警告:setup.py install 已弃用。请使用 build 和 pip 等基于标准的工具。

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

ID: python/setuptools-deprecated-setup-py-install

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

版本兼容性

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

根因分析

直接运行 `python setup.py install`。新版 setuptools 会发出弃用警告,并最终移除直接安装支持,改用 PEP 517 构建。

English

Running `python setup.py install` directly. Modern setuptools emits a DeprecationWarning and eventually will remove direct install support in favor of PEP 517 builds.

generic

解决方案

  1. 98% 成功率
    Use pip to install the project in editable or normal mode: python -m pip install . or python -m pip install -e .
  2. 95% 成功率
    Build a wheel then install it: python -m pip install build && python -m build && python -m pip install dist/*.whl

无效尝试

常见但无效的做法:

  1. 60% 失败

    Hides the warning but the install path is still deprecated and may produce a broken egg-info layout.

  2. 80% 失败

    Pins to an old setuptools that lacks PEP 517 support and breaks other modern packages.