使用来自pylab的ion()会导致matplotlib挂起 [英] Using ion() from pylab causes matplotlib to hang
本文介绍了使用来自pylab的ion()会导致matplotlib挂起的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用Enthought的32位python发行版为mac。
I'm using Enthought's 32 bit python distribution for mac.
如果我尝试:
$ ipython
In [1] from pylab import *
In [2] ion()
In [3] plot([1,2],[1,2])
图形已创建,但python会在尝试绘图时冻结。
The figure is created, but python freezes while trying to plot.
我做错了什么或者这是一个错误?
Am I doing something wrong or is this a bug?
通过在 ipython中运行来绘图 - -pylab
工作正常
推荐答案
我使用的是'WXAgg'后端,我切换到'macosx '这似乎解决了问题
I was using the 'WXAgg' backend and I switched to 'macosx' this seems to fix the problem
In [1]: import matplotlib
In [2]: matplotlib.get_backend()
Out[2]: 'WXAgg'
In [3]: matplotlib.use('macosx')
In [4]: matplotlib.get_backend()
Out[4]: 'MacOSX'
In [5]: from pylab import *
In [6]: ion()
In [7]: plot([1,2]) # now works fine
这篇关于使用来自pylab的ion()会导致matplotlib挂起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文