简体   繁体   English

麻线:警告:缺少`long_description_content_type`

[英]twine: warning: `long_description_content_type` missing

This is what my setup.py looks like:这就是我的 setup.py 的样子:

from distutils.core import setup

setup(
    author='...',
    description='...',
    download_url='...',
    license='...',
    long_description=open('README.md', 'r').read(),
    long_description_content_type='text/markdown',
    name='...',
    packages=['...'],
    url='...',
    version='...'
)

Then, I can run python setup.py sdist without any errors.然后,我可以运行python setup.py sdist没有任何错误。 But if I check the package with twine ( twine check dist/* ), I get the following warning:但是,如果我用麻线( twine check dist/* )检查 package,我会收到以下警告:

 `long_description` has syntax errors in markup and would not be rendered on PyPI.
  warning: `long_description_content_type` missing. defaulting to `text/x-rst`.

All of my packages are up to date, and I have no duplicate or multi-line attributes.我所有的包都是最新的,我没有重复或多行属性。 What is causing this, and how can I fix it?是什么原因造成的,我该如何解决?

This is because you're using the setup function provided by distutils.core .这是因为您使用的是distutils.core提供的设置 function 。 Use setuptools instead:请改用setuptools

from setuptools import setup

distutils.core doesn't expect the long_description_content_type to be provided, and seemingly ignores it. distutils.core不希望提供long_description_content_type ,并且似乎忽略了它。 It actually says this when you run setup.py:当您运行 setup.py 时,它实际上是这样说的:

UserWarning: Unknown distribution option: 'long_description_content_type'

Although that's easy to miss, since it's at the top of a long block of otherwise error-free logs.尽管这很容易被忽略,因为它位于一长串无错误日志的顶部。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Twine 将“long_description_content_type”默认为 text/x-rst - Twine is defaulting "long_description_content_type" to text/x-rst 为什么我有Description-Content-Type:UNKNOWN - Why do I have Description-Content-Type: UNKNOWN 在Pypi上传中为markdown README指定Description-Content-Type - Specify Description-Content-Type in Pypi upload for markdown README Elasticsearch:缺少Content-Type标头 - Elasticsearch: Content-Type header is missing Facepy事件数据,描述丢失 - Facepy events data, description is missing HEAD 请求在重定向时缺少内容类型 (301) - HEAD request missing content-type on redirect (301) 未找到麻线(-bash:麻线:未找到命令) - twine not found (-bash: twine: command not found) Python - 创建egg文件有什么用说明和长说明 - Python - Creating egg file what is the use of description and long description 安装文件中 long_description 的 Tox 错误 - Tox error for long_description in setup file 警告:瓷砖 memory 超出限制,某些内容可能无法绘制,并且在使用 ChromeDriver Selenium 渲染长页面时无法捕获屏幕截图 - WARNING: tile memory limits exceeded, some content may not draw and Unable to capture screenshot while rendering long page using ChromeDriver Selenium
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM