无法导入PyQtGraph,因为无法导入包PySide,PyQt4或PyQt5?

时间:2017-01-20 02:41:00

标签: python pyqt4 pyside pyqt5 pyqtgraph

我最近下载了PyQtGraph并使用的是Python 2.7。我试图从documentation

运行简单示例
import pyqtgraph.examples
pyqtgraph.examples.run()

但是,当我尝试在iPython或脚本中导入包时,我会遇到以下错误:

Exception: PyQtGraph requires one of PyQt4, PyQt5 or PySide; none of these packages could be imported.

我已经通过Homebrew安装了PyQt5(因为它不能用PySide或PyQt4这样做)但我仍然得到同样的错误。当我尝试导入任何这些软件包时,我收到类似的错误,告诉我它们无法导入。当我尝试导入PyQtGraph时,这是我的追溯:

    In [1]: import pyqtgraph as pg
-----------------------------------------------------------
Exception                 Traceback (most recent call last)
<ipython-input-1-e5a51b506085> in <module>()
----> 1 import pyqtgraph as pg

/usr/local/lib/python2.7/site-packages/pyqtgraph/__init__.py in <module>()
     11 ## 'Qt' is a local module; it is intended mainly to cover up the differences
     12 ## between PyQt4 and PySide.
---> 13 from .Qt import QtGui
     14
     15 ## not really safe--If we accidentally create another QApplication, the process hangs (and it is very difficult to trace the cause)

/usr/local/lib/python2.7/site-packages/pyqtgraph/Qt.py in <module>()
     42
     43 if QT_LIB is None:
---> 44     raise Exception("PyQtGraph requires one of PyQt4, PyQt5 or PySide; none of these packages could be imported.")
     45
     46 if QT_LIB == PYSIDE:

Exception: PyQtGraph requires one of PyQt4, PyQt5 or PySide; none of these packages could be imported.

当我尝试导入任何PySide,PyQt4或PyQt5包时:

In [7]: import PyQt4
-----------------------------------------------------------
ImportError               Traceback (most recent call last)
<ipython-input-7-0c3b8c686717> in <module>()
----> 1 import PyQt4

ImportError: No module named PyQt4

0 个答案:

没有答案