问题
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