【发布时间】:2014-06-26 03:38:39
【问题描述】:
我最近将 ipython 升级到 2.0.0,但无法使用内联图。如果我尝试
%pylab inline
plot([1,2],[1,2])
我得到以下输出:
Populating the interactive namespace from numpy and matplotlib
[<matplotlib.lines.Line2D at 0x10ffcf080>]
/usr/local/lib/python3.4/site-packages/IPython/core/formatters.py:239: FormatterWarning: Exception in image/png formatter: _image_module::readpng: png_create_read_struct failed
FormatterWarning,
<matplotlib.figure.Figure at 0x10e77ca58>
在控制台中,出现以下错误:
ERROR:tornado.application:Uncaught exception in /api/kernels/0a214dee-3143-4d34-89cb-9d65ce154fe6/shell
Traceback (most recent call last):
File "/usr/local/lib/python3.4/site-packages/tornado/websocket.py", line 322, in wrapper
return callback(*args, **kwargs)
File "/usr/local/lib/python3.4/site-packages/IPython/html/services/kernels/handlers.py", line 122, in on_message
self.session.send(self.zmq_stream, msg)
File "/usr/local/lib/python3.4/site-packages/IPython/kernel/zmq/session.py", line 646, in send
stream.send_multipart(to_send, copy=copy)
AttributeError: 'NoneType' object has no attribute 'send_multipart'
知道这里发生了什么吗?
编辑:我使用的是 python 3.4.0、ipython 2.0.0 和 matplotlib 1.3.1
【问题讨论】:
-
看起来你的 ipython 安装很糟糕,我怀疑是因为有一些旧文件挂在周围。我建议删除所有内容并重新安装。我还建议使用虚拟环境而不是在系统级别安装。
-
你有没有弄清楚是什么原因造成的?
-
作为第一种可能性,如果有 ~/.ipython 目录,我将删除(或移动到其他名称,如果你想保存它)。可能是之前版本的设置导致了问题。
标签: python-3.x matplotlib ipython-notebook