python config_error ai_generated true

错误:setuptools.errors.PackageNotFoundError:'data_files' 模式 'config/*.ini' 未匹配任何文件

ERROR: setuptools.errors.PackageNotFoundError: The 'data_files' pattern 'config/*.ini' did not match any files

ID: python/setuptools-extra-files-not-found

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

版本兼容性

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

根因分析

setup.cfg 或 setup.py 中指定的 glob 模式在包中未找到任何文件。

English

The specified glob pattern in setup.cfg or setup.py does not find any files in the package.

generic

解决方案

  1. 95% 成功率 Correct the path to the actual files
    Ensure the config directory exists and contains .ini files. Example: mkdir config; touch config/settings.ini
  2. 90% 成功率 Use package_data instead of data_files
    In setup.cfg: [options.package_data]
    * = config/*.ini

无效尝试

常见但无效的做法:

  1. Changing the pattern to '*.ini' without a directory 60% 失败

    May match unintended files; also doesn't solve the path issue.

  2. Removing the data_files configuration entirely 80% 失败

    Necessary files will be missing from the distribution.