How do I add images to a PyPi readme (that works on GitHub)?

前端 未结 2 522
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-01 16:55

In my readme on GitHub I have several images that are present there in my project\'s source tree which I reference successfully with directives like

.. image         


        
相关标签:
2条回答
  • 2021-01-01 17:35

    PyPI will not read your package distributions for the image. You have to use the image's external link, for example:

    .. image::  https://raw.githubusercontent.com/greyli/flask-share/master/images/demo.png
    

    Here I use the image hosted by GitHub, the real demo is on PyPI.

    P.S. To get the image's raw link on GitHub, right-click the image and choose Open image in new tab.

    0 讨论(0)
  • 2021-01-01 17:36

    If you have your images on Github, navigate to the image then right click on download button and copy link address:

    Then you can add it in your README.md file:

    ![](https://github.com/your_username/your_repository/raw/master/images/img2.png)
    

    It should be rendered properly both on Github and PyPi.

    0 讨论(0)
提交回复
热议问题