问题
I'm using Enthought's 32 bit python distribution for mac.
If I try:
$ ipython
In [1] from pylab import *
In [2] ion()
In [3] plot([1,2],[1,2])
The figure is created, but python freezes while trying to plot.
Am I doing something wrong or is this a bug?
plotting by running in ipython --pylab works fine
回答1:
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
来源:https://stackoverflow.com/questions/12827969/using-ion-from-pylab-causes-matplotlib-to-hang