Python 2.7.12 |Anaconda 4.2.0 (64-bit)| Spyder 3.0.1| IPython 5.1.0
(运行在Windows操作系统)
当需要在新窗口中请求绘图时:
%matplotlib qt
我遇到了一个错误:
Traceback (most recent call last):
File "<ipython-input-2-6ad73d0e50c7>", line 1, in <module>
get_ipython().magic(u'matplotlib qt')
File "C:\Anaconda2\lib\site-packages\IPython\core\interactiveshell.py", line 2158, in magic
return self.run_line_magic(magic_name, magic_arg_s)
File "C:\Anaconda2\lib\site-packages\IPython\core\interactiveshell.py", line 2079, in run_line_magic
result = fn(*args,**kwargs)
File "<decorator-gen-105>", line 2, in matplotlib
File "C:\Anaconda2\lib\site-packages\IPython\core\magic.py", line 188, in <lambda>
call = lambda f, *a, **k: f(*a, **k)
File "C:\Anaconda2\lib\site-packages\IPython\core\magics\pylab.py", line 100, in matplotlib
gui, backend = self.shell.enable_matplotlib(args.gui)
File "C:\Anaconda2\lib\site-packages\IPython\core\interactiveshell.py", line 2947, in enable_matplotlib
pt.activate_matplotlib(backend)
File "C:\Anaconda2\lib\site-packages\IPython\core\pylabtools.py", line 295, in activate_matplotlib
matplotlib.pyplot.switch_backend(backend)
File "C:\Anaconda2\lib\site-packages\matplotlib\pyplot.py", line 232, in switch_backend
_backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
File "C:\Anaconda2\lib\site-packages\matplotlib\backends\__init__.py", line 32, in pylab_setup
globals(),locals(),[backend_name],0)
File "C:\Anaconda2\lib\site-packages\matplotlib\backends\backend_qt4agg.py", line 18, in <module>
from .backend_qt5agg import FigureCanvasQTAggBase as _FigureCanvasQTAggBase
File "C:\Anaconda2\lib\site-packages\matplotlib\backends\backend_qt5agg.py", line 16, in <module>
from .backend_qt5 import QtCore
File "C:\Anaconda2\lib\site-packages\matplotlib\backends\backend_qt5.py", line 31, in <module>
from .qt_compat import QtCore, QtGui, QtWidgets, _getSaveFileName, __version__
File "C:\Anaconda2\lib\site-packages\matplotlib\backends\qt_compat.py", line 137, in <module>
from PyQt4 import QtCore, QtGui
ImportError: No module named PyQt4