运行将pyqtgraph导入为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\envs\3dTracker\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\envs\3dTracker\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 | Anaconda,Inc. | (默认值,2018年8月26日,16:05:27)[MSC v.1900 64位(AMD64)]
我有一些使用pyqtgraph的代码,今天我意识到我无法运行那些程序。在他们完美运行之前。 我记得在环境中发生的唯一变化就是安装了熊猫。
我尝试重新安装pyqtgraph和pyqt失败
答案 0 :(得分:1)
PyQtGraph自动确定安装了哪个Qt版本。默认情况下,它首先查找PyQt4,然后查找PySide,最后查找PyQt5。查看您的堆栈跟踪信息,似乎有一些旧的,损坏的PyQt4安装,尝试将其导入而没有成功。
您可以通过将PYQTGRAPH_QT_LIB
环境变量设置为PyQt5
来强制PyQtGraph使用PyQt5。设置环境变量后,您可能需要重新启动Jupyter。