Image in README.rst not displaying in pypi

自古美人都是妖i 提交于 2019-12-22 04:10:13

问题


I would like an image linked in my README.rst file to be displayed when I upload my package to PyPI. In my README I have:

.. image:: example-python.png
   :height: 100px
   :width: 200px
   :scale: 100 %
   :align: center

and in MANIFEST.in I have:

# Include the image file
include example-python.png

Right now it's not displaying in testpypi. It shows up just fine on GitHub, however. Am I doing something wrong?


回答1:


In .. image:: example-python.png you use relative URL, i.e. a browser expects the image in the same directory as the package. I doubt it's possible to upload an image at PyPI. Upload it somewhere and change the URL to be an absolute URL. An image already at Github is ok I think.

include directive in MANIFEST.in doesn't work because it includes the image into source (sdist) archive where browsers will never look it up.



来源:https://stackoverflow.com/questions/35591285/image-in-readme-rst-not-displaying-in-pypi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!