为什么twine上传文件到pypi会弹出如下错误

Why does the following error pop up when twine uploading files to pypi

当我执行以下行并输入我的信息时

twine upload dist/*

弹出如下错误

HTTPError: 400 Client Error: The description failed to render in the default format of reStructuredText. See https://pypi.org/help/#description-content-type for more information. for url: https://upload.pypi.org/legacy/

去了url之后,我离解决问题还差得很远。 我的 setup.py 如下(删除了信息)

import setuptools

with open("README.md", "r") as fh:
    long_description = fh.read()

setuptools.setup(
    name="quizmaker",
    version="0.0.1",
    author="my secret name",
    author_email="email",
    description="secret descripting",
    long_description=long_description,
    long_description_content_type="text/markdown",
    url="the url",
    packages=setuptools.find_packages(),

    python_requires='>=3.6',
)

如果对此有任何解决方案,请告诉我。谢谢。

两种可能性:

  1. 您忘记重建发行版或正在上传没有 long_description_content_type 的旧发行版。确保您从一个空的 dist 目录开始,重建您的发行版然后上传。
  2. 在支持 long_description_content_type 之前,您使用的是某些打包依赖项的旧版本。您需要 setuptools>=38.6.0wheel>=0.31.0twine>=1.11.0。使用 python -m pip install -U setuptools wheel twine 将它们全部升级,然后执行 #1.