python config_error ai_generated true

错误:未知的发行选项:'entry_points'

error: Unknown distribution option: 'entry_points'

ID: python/setup-py-unknown-distutils-command

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

版本兼容性

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

根因分析

较旧的setuptools版本不支持setup.py中的'entry_points';应正确使用'entry_points'。

English

Older setuptools versions do not support 'entry_points' in setup.py; should use 'entry_points' correctly.

generic

解决方案

  1. 95% 成功率 Upgrade setuptools and use correct syntax
    pip install --upgrade setuptools
    # In setup.py:
    entry_points={
        'console_scripts': ['mycommand=mymodule:main']
    }
  2. 90% 成功率 Use setup.cfg for entry points
    # setup.cfg
    [options.entry_points]
    console_scripts =
        mycommand = mymodule:main

无效尝试

常见但无效的做法:

  1. Renaming parameter to 'console_scripts' 70% 失败

    The correct parameter is 'entry_points' with dict format; renaming breaks functionality.

  2. Removing entry_points entirely 60% 失败

    Removes console scripts functionality, which may be needed.