python config_error ai_generated true

错误:setup.py必须与setup.cfg在同一目录中

error: setup.py must be in the same directory as the setup.cfg

ID: python/setuptools-setup-py-not-found

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

版本兼容性

版本状态引入弃用备注
3.8 active

根因分析

当使用setup.cfg进行配置时,setuptools期望setup.py与setup.cfg位于同一目录。

English

Setuptools expects setup.py to exist alongside setup.cfg when using setup.cfg for configuration.

generic

解决方案

  1. 95% 成功率 Create a minimal setup.py in the same directory
    touch setup.py
    # Content:
    from setuptools import setup
    setup()
  2. 90% 成功率 Move setup.cfg to the same directory as setup.py
    mv /path/to/setup.cfg .

无效尝试

常见但无效的做法:

  1. Removing setup.cfg 60% 失败

    Loses all configuration; may break build.

  2. Creating empty setup.py in parent directory 80% 失败

    Must be in same directory; parent not checked.