导入pyqtgraph jupyter notebook时出错

Error when importing pyqtgraph jupyter notebook

我在 运行ning import pyqtgraph as pg

后收到此错误
ImportError                               Traceback (most recent call last)
<ipython-input-2-952aa750c92c> in <module>()
      6 import contextlib
      7
----> 8 import pyqtgraph as pg
      9 import pqtgraph.opengl as gl
     10

~\AppData\Local\conda\conda\envsdTracker\lib\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)

~\AppData\Local\conda\conda\envsdTracker\lib\site-packages\pyqtgraph\Qt.py in <module>()
    131 elif QT_LIB == PYQT4:
    132
--> 133     from PyQt4 import QtGui, QtCore, uic
    134     try:
    135         from PyQt4 import QtSvg

ImportError: cannot import name 'QtGui'

Windows 10 运行 在 jpyter 笔记本中 3.5.6 |蟒蛇公司| (默认,2018 年 8 月 26 日,16:05:27)[MSC v.1900 64 位 (AMD64)]

我有一些使用 pyqtgraph 的代码,今天我意识到我无法 运行 这些程序。在他们 运行 完美之前。 我记得在环境中唯一改变的是安装 pandas.

我尝试重新安装 pyqtgraph 和 pyqt 但没有成功

PyQtGraph 自动确定安装的 Qt 版本。默认情况下,它首先查找 PyQt4,然后查找 PySide,最后查找 PyQt5。查看您的堆栈跟踪,似乎有一些旧的、损坏的 PyQt4 安装尝试导入但没有成功。

您可以通过将 PYQTGRAPH_QT_LIB 环境变量设置为 PyQt5 来强制 PyQtGraph 使用 PyQt5。您可能需要在设置环境变量后重新启动 Jupyter。