在 iPython qtconsole 中显示图像

Displaying an Image in the iPython qtconsole

我正在尝试通过以下方式在 ipython qtconsole 中显示图像:

from IPython.display import Image
Image(filename='sky1024px.jpg')

但我得到以下输出

Out[6]: <IPython.core.display.Image object>

我通过 Anaconda 安装了 python,它具有显示图像所需的库。我尝试搜索 Whosebug,但找不到任何答案。

我运行python的版本是:

  IPython QtConsole 3.2.0
  Python 2.7.10 |Anaconda 2.3.0 (x86_64)| (default, May 28 2015, 17:04:42) 

我想让它工作的原因是我在搞 google deepdream 项目,它看起来非常有趣和疯狂。参见:https://github.com/google/deepdream/blob/master/dream.ipynb

抱歉,如果这是一个从未使用过的简单问题 python,我已经为此苦苦思索了几个小时!

谢谢!

尽管我必须承认我用得不多 IPython,但以下代码应该可以工作。

from PIL import Image
im = Image.open('/home/students/sky1024px.jpg')
im.show()

我在使用 display 渲染了 Image 之后发现:

from IPython.core.display import Image, display
display(Image('https://upload.wikimedia.org/wikipedia/commons/2/2a/Svm_max_sep_hyperplane_with_margin.png'))