python config_error ai_generated true

error: option --install-lib not recognized usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...] or: setup.py --help [cmd1 cmd2 ...] or: setup.py --help-commands or: setup.py cmd --help

ID: python/setuptools-unknown-distribution-option

Also available as: JSON · Markdown · 中文
80%Fix Rate
85%Confidence
0Evidence
2024-04-19First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.x active — — —

Root Cause

A custom distutils/setuptools command is invoked with an option it does not declare in user_options, so the option parser rejects it.

generic

中文

调用自定义 distutils/setuptools 命令时传入了它未在 user_options 中声明的选项,因此选项解析器拒绝该选项。

Workarounds

  1. 95% success
    In the Command subclass, add user_options = [('install-lib=', None, 'target directory')] and handle it in initialize_options/finalize_options.
  2. 90% success
    Move the setting into setup.cfg under [install] install-lib = /path and run python setup.py install.

Dead Ends

Common approaches that don't work:

  1. 90% fail

    The command still does not declare the option; order does not matter.

  2. 95% fail

    Verbosity does not register unknown options.

  3. 95% fail

    Privilege is unrelated to option parsing.