python config_error ai_generated true

SetuptoolsDeprecationWarning:setup.py install 已弃用,请使用 build 和 pip 等基于标准的工具。SetuptoolsDeprecationWarning:namespace_packages 参数已弃用。

SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. Please see https://setuptools.pypa.io/en/latest/userguide/quickstart.html setup.py install ~~~~~~~~~~~~^ SetuptoolsDeprecationWarning: The namespace_packages parameter is deprecated.

ID: python/setuptools-find-namespace-packages-deprecated

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

版本兼容性

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

根因分析

项目仍使用已弃用的 setup.py install 路径和 namespace_packages 关键字,setuptools 已弃用它们,推荐使用 PEP 420 原生命名空间包和基于 pyproject.toml 的构建。

English

The project still uses the deprecated setup.py install path and namespace_packages keyword, which setuptools has deprecated in favor of PEP 420 native namespace packages and pyproject.toml-based builds.

generic

解决方案

  1. 85% 成功率
    # remove namespace_packages from setup.cfg/setup.py
    # rely on implicit namespace packages:
    # mypkg/sub/__init__.py (implicit, no __init__ needed at mypkg level)
    pip install -e .
  2. 90% 成功率
    python -m pip install build
    python -m build
    pip install dist/*.whl

无效尝试

常见但无效的做法:

  1. 70% 失败

    Suppresses warnings but the deprecated code path still runs and will be removed in future setuptools releases.

  2. 80% 失败

    Avoids the warning but blocks security fixes and breaks on Python 3.12+ where distutils is gone.