python config_error ai_generated true

错误:setup.cfg 中的错误:entry_points 必须是字典,而不是列表

error: Error in setup.cfg: entry_points must be a dictionary, not a list

ID: python/setuptools-entry-point-error

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

版本兼容性

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

根因分析

setup.cfg 中的 entry_points 配置格式错误,应为字典而非列表。

English

The entry_points configuration in setup.cfg is incorrectly formatted as a list instead of a dictionary.

generic

解决方案

  1. 95% 成功率 Format entry_points as a dictionary in setup.cfg
    [options.entry_points]
    console_scripts =
        mycommand = mypackage.module:function
  2. 90% 成功率 Define entry_points in setup.py as a dict
    entry_points={'console_scripts': ['mycommand=mypackage.module:function']}

无效尝试

常见但无效的做法:

  1. Converting to a list of strings 90% 失败

    setuptools expects a dict with console_scripts keys.

  2. Omitting entry_points entirely 70% 失败

    This removes the feature but may break expected CLI commands.