ipython控制台绘图后端 tkinter_在Jupyter Ipython中更改matplotlib的默认后端

现在,matplotlib的默认后端是’module://ipykernel.pylab.backend_inline’

我想把它切换到TkAGG.我编辑了matplotlibrc文件

〜/ anaconda2 / lib中/ python2.7 /站点包/ matplotlib / MPL-数据/ matplotlibrc /

加上

后端:TkAgg

它确实切换了python的后端,但没有切换到Jupyter.

现在每次我在Jupyter中开始一个新的笔记本,我必须做%matplotlib tk,是不是有一个很好的方法让TkAGG成为Jupyter的默认后端?

解决方法:

所以我的想法是找到你的IPython配置文件.见configure IPython.应该是

/.ipython/profile_default/ipython_kernel_config.py

如果它尚不存在,请通过>创建它. ipython个人资料创建.

在此文件中找到设置c.InteractiveShellApp.matplotlib并将其设置为“tk”.它应该看起来像

## Configure matplotlib for interactive use with the default matplotlib backend.

c.InteractiveShellApp.matplotlib = "tk"

保存文件并重新启动内核.

标签:python,matplotlib,jupyter

来源: https://codeday.me/bug/20190823/1698016.html

你可能感兴趣的:(ipython控制台绘图后端,tkinter)