如何将图像添加到PyPi自述文件(可在GitHub上运行)? [英] How do I add images to a PyPi readme (that works on GitHub)?

查看:113
本文介绍了如何将图像添加到PyPi自述文件(可在GitHub上运行)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在GitHub上的自述文件中,我的项目的源代码树中有几张图像,这些图像可以通过类似的指令成功引用

.. image:: ./doc/source/_static/figs/moon_probe.png

我还希望在PyPi中生成相同的自述文件时出现这些图像.

我如何(a)确保PyPi上存在供自述文件访问的图像,以及(b)制定.. image::指令来访问它们?

解决方案

PyPI不会读取该映像的软件包分发.您必须使用图片的外部链接,例如:

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

在这里,我使用Github托管的图像,真正的演示在 PyPI 上. /p>

P.S.要在Github上获取图像的原始链接,请在图像上单击鼠标左键,然后选择 在新标签页中打开图像 .

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:: ./doc/source/_static/figs/moon_probe.png

I would also like to have these images appear when this same readme is generated in PyPi.

How do I (a) ensure that images are present on PyPi for the readme to access and (b) formulate the .. image:: directive to access them?

解决方案

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, left click the image and choose Open image in new tab.

这篇关于如何将图像添加到PyPi自述文件(可在GitHub上运行)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆