python type_error ai_generated true

TypeError: entry_points() got an unexpected keyword argument 'console_scripts'

ID: python/setuptools-entry-points-error

Also available as: JSON · Markdown · 中文
80%Fix Rate
84%Confidence
0Evidence
2024-03-22First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.8 active
3.9 active
3.10 active

Root Cause

Incorrect use of entry_points parameter in setup.py; console_scripts should be a key in a dictionary, not a separate argument.

generic

中文

在 setup.py 中错误使用 entry_points 参数;console_scripts 应该是字典中的一个键,而不是单独的参数。

Workarounds

  1. 95% success Correctly structure entry_points as a dictionary
    `setup(..., entry_points={'console_scripts': ['mycmd=mymodule:main']})`
  2. 90% success Use pyproject.toml with [project.scripts] instead
    In pyproject.toml: `[project.scripts]
    mycmd = "mymodule:main"`

Dead Ends

Common approaches that don't work:

  1. Passing console_scripts as a list directly to setup() 70% fail

    setup() expects entry_points as a dict; console_scripts is not a valid top-level parameter.

  2. Removing entry_points entirely 50% fail

    This removes the command-line scripts, which may be required for the package's functionality.