我正在尝试测试 Matplotlib 是否在 Ubuntu 上的 PyQt 中工作。我一直在使用 PyQt,我想在 Pyqt 中嵌入 Matplotlib。我遵循了http://eli.thegreenplace.net/2009/01/20/matplotlib-with-pyqt-guis/给出的代码,但是在导入matplotlib
.
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
File "/usr/lib/pymodules/python2.6/matplotlib/backends/backend_qt4agg.py", line 9, in <module>
from matplotlib.figure import Figure
File "/usr/lib/pymodules/python2.6/matplotlib/figure.py", line 18, in <module>
from axes import Axes, SubplotBase, subplot_class_factory
File "/usr/lib/pymodules/python2.6/matplotlib/axes.py", line 2, in <module>
import math, sys, warnings, datetime, new
File "/home/kasa/Desktop/new.py", line 25, in <module>
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
ImportError: cannot import name FigureCanvasQTAgg
我从终端运行这些导入命令,它工作正常。有人可以弄清楚我的安装有什么问题。