【问题标题】:Troubles after updating ipython (%matplotlib nbagg)更新 ipython 后出现的问题 (%matplotlib nbagg)
【发布时间】:2015-05-16 16:20:30
【问题描述】:

我安装了 anaconda 发行版,我通常运行 ipython notebook --pylab inline。我使用pip install (windows 8.1) 更新了ipython,我不必再编写--pylab inline 来启动了

我开始在单元格中写作:%matplotlib nbaggmatplotlib.use['nbagg'],但是当我绘制一些东西时,它会显示这个空框:

我期待的是交互式绘图框。

ipython 日志显示:

[IPKernelApp] ERROR | No such comm: 7cfe982045bb4d0db0f14deff7258130

【问题讨论】:

  • 我认为这个问题是由于没有最新版本的matplotlib引起的。您能否检查您开始 ipython notebookconsole 以获取错误消息并将它们添加到您的问题中?这将使有类似问题的其他人更容易找到您的问题。
  • 另请注意,现在不推荐使用ipython notebook --pylab inline。相反,您可以在笔记本的第一行写%matplotlib inline 用于静态内联图像,或%matplotlib notebook/``%matplotlib nbagg` 用于交互式绘图(就像您在问题中所做的那样)。
  • 我得到了同样的控制台错误,但在我的情况下,我确实看到了情节

标签: python matplotlib ipython ipython-notebook jupyter


【解决方案1】:

我猜这个问题是由太旧的matplotlib 版本引起的。将%matplotlib nbaggipython>=3.0 一起使用需要matplotlib>=1.4.3(注意%matplotlib notebook%matplotlib nbagg 现在是同义词)。

通过pip install --upgrade matplotlib 更新 matplotlib 可能会解决此问题。另请参阅我在 github 上的 issue-7797。感谢 jenshnielsen 提供此信息。

【讨论】:

    【解决方案2】:

    应该同时更新 matplotlib 和 ipython...

    sudo pip install -U ipython
    sudo pip install -U matplotlib
    

    在窗户上:

    pip install --upgrade matplotlib
    pip install --upgrade ipython
    

    【讨论】:

    • 在我的案例中,欺骗性的事情是错误提到了“TCLError”
    猜你喜欢
    • 2016-02-14
    • 2015-01-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-02-24
    • 2016-08-01
    相关资源
    最近更新 更多