导入pyplot时出错

时间:2015-03-22 19:27:28

标签: python matplotlib pyqt5

当我尝试导入pyplot时:

import matplotlib.pyplot as plt

我收到此错误:

  File "/home/riless/script.py", line 7, in <module>
    import matplotlib.pyplot as plt
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 109, in <module>
    _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/__init__.py", line 32, in pylab_setup
    globals(),locals(),[backend_name],0)
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_qt5agg.py", line 18, in <module>
    from .backend_qt5 import QtCore
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_qt5.py", line 31, in <module>
    from .qt_compat import QtCore, QtGui, QtWidgets, _getSaveFileName, __version__
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/qt_compat.py", line 111, in <module>
    from PyQt5 import QtCore, QtGui, QtWidgets
ImportError: cannot import name QtGui

我不知道它是否有帮助,但是:

  • 我已经安装了与PySide一起使用的Qt5。
  • 当我编译PyQt gpl 5.4.1时,我已将选项--qmake设置为包含Qt5的qmake二进制文件的路径。
  • 我已经使用pip install matplotlib
  • 安装了matplotlib

修改

  • 请注意,QtCore似乎导入得很好但是存在问题avec QtGui

0 个答案:

没有答案