python config_error ai_generated true

错误:包目录 'mypackage/data' 不存在

error: package directory 'mypackage/data' does not exist

ID: python/setuptools-missing-package-data

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

版本兼容性

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

根因分析

setup.py 或 setup.cfg 引用了源代码树中不存在的包数据目录。

English

The setup.py or setup.cfg references a package data directory that does not exist in the source tree.

generic

解决方案

  1. 95% 成功率
    mkdir -p mypackage/data && touch mypackage/data/__init__.py
  2. 90% 成功率
    In setup.py, change include_package_data=True to a proper MANIFEST.in or package_data dict.

无效尝试

常见但无效的做法:

  1. 60% 失败

    Empty directories are often ignored; the build may still fail if the directory is expected to contain files.

  2. 40% 失败

    Removing it may exclude necessary data files from the distribution.