python config_error ai_generated true

ValueError:未知的分发选项:'long_description_content_type'

ValueError: Unknown distribution option: 'long_description_content_type'

ID: python/setuptools-long-description-content-type-error

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

版本兼容性

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

根因分析

setup.py 使用了已安装的 setuptools 版本不识别的关键字参数(例如较旧的 setuptools)。

English

The setup.py uses a keyword argument that is not recognized by the installed version of setuptools (e.g., older setuptools).

generic

解决方案

  1. 95% 成功率 Upgrade setuptools to a version that supports this option
    `pip install --upgrade setuptools>=40.0`
  2. 90% 成功率 Use pyproject.toml to specify the content type
    In pyproject.toml: `[project]
    ...
    description = "..."
    readme = "README.md"` (which implies content type)

无效尝试

常见但无效的做法:

  1. Removing long_description_content_type entirely 40% 失败

    This may cause the long description to be rendered as plain text on PyPI, losing formatting.

  2. Using a different name like 'content_type' 80% 失败

    The correct parameter name is 'long_description_content_type'; any other name is invalid.