我开始严重依赖IPython笔记本应用程序来开发和记录算法。这太棒了;但有些事情看起来应该是可能的,但我不知道该怎么做:

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?


当前回答

我从来不能得到“插入图像”到markdown单元格工作。但是,拖拽进入的png文件保存在我的笔记本相同的目录。它把文字带进了细胞

""

shift + enter >图像现在显示在笔记本中。

FWIW

其他回答

jupyter笔记本的最后一个版本接受复制/粘贴的图像本机

如果你想在Markdown单元格中显示图像,那么使用:

<img src="files/image.png" width="800" height="400">

如果你想在Code单元格中显示图像,请使用:

from IPython.display import Image
Image(filename='output1.png',width=800, height=400)

我从来不能得到“插入图像”到markdown单元格工作。但是,拖拽进入的png文件保存在我的笔记本相同的目录。它把文字带进了细胞

""

shift + enter >图像现在显示在笔记本中。

FWIW

我使用的是ipython 2.0,所以只有两行。

from IPython.display import Image
Image(filename='output1.png')

我把IPython笔记本和图片放在同一个文件夹里。我使用Windows。图像名称为“phuong huong xac dinh.PNG”。

在Markdown:

<img src="phuong huong xac dinh.PNG">

代码:

from IPython.display import Image
Image(filename='phuong huong xac dinh.PNG')