将图像插入IPython笔记本降价 [英] Inserting image into IPython notebook markdown

查看:68
本文介绍了将图像插入IPython笔记本降价的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始严重依赖IPython笔记本应用来开发和记录算法。太棒了;但有些东西似乎应该是可能的,但我无法弄清楚如何做到这一点:

I am starting to depend heavily on the IPython notebook app to develop and document algorithms. It is awesome; but there is something that seems like it should be possible, but I can't figure out how to do it:

我想将一个本地图像插入我的(本地)IPython笔记本降价有助于记录算法。我知道足够的东西可以添加像< img src =image.png> 这样的东西到降价处,但就我的知识而言,这就是我的知识。我假设我可以将图像放在由127.0.0.1:8888(或某个子目录)表示的目录中以便能够访问它,但我无法弄清楚该目录的位置。 (我正在使用Mac。)那么,是否有可能在没有太多麻烦的情况下做我想做的事情?

I would like to insert a local image into my (local) IPython notebook markdown to aid in documenting an algorithm. I know enough to add something like <img src="image.png"> to the markdown, but that is about as far as my knowledge goes. I assume I could put the image in the directory represented by 127.0.0.1:8888 (or some subdirectory) to be able to access it, but I can't figure out where that directory is. (I'm working on a mac.) So, is it possible to do what I'm trying to do without too much trouble?

推荐答案

笔记本目录中的文件位于files /url下。因此,如果它在基本路径中,它将是< img src =files / image.png> ,并且子目录等也可用:< img src =files / subdir / image.png> 等。

Files inside the notebook dir are available under a "files/" url. So if it's in the base path, it would be <img src="files/image.png">, and subdirs etc. are also available: <img src="files/subdir/image.png">, etc.

更新:从IPython 2.0开始,不再需要 files / 前缀(参见发行说明)。所以现在解决方案< img src =image.png> 只是按预期工作。

Update: starting with IPython 2.0, the files/ prefix is no longer needed (cf. release notes). So now the solution <img src="image.png"> simply works as expected.

这篇关于将图像插入IPython笔记本降价的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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