[英]Error when importing pyqtgraph jupyter notebook
我將pg導入pyqtgraph運行后出現此錯誤
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'
在jpyter筆記本電腦3.5.6中運行的Windows 10 | Anaconda,Inc. | (默認值,2018年8月26日,16:05:27)[MSC v.1900 64位(AMD64)]
我有一些使用pyqtgraph的代碼,今天我意識到我無法運行那些程序。 在他們完美運行之前。 我記得在環境中更改的唯一一件事就是安裝熊貓。
我嘗試重新安裝pyqtgraph和pyqt失敗
PyQtGraph自動確定安裝了哪個Qt版本。 默認情況下,它首先查找PyQt4,然后查找PySide,最后查找PyQt5。 查看您的堆棧跟蹤信息,似乎有一些舊的,損壞的PyQt4安裝,嘗試將其導入失敗。
您可以通過將PYQTGRAPH_QT_LIB
環境變量設置為PYQTGRAPH_QT_LIB
來強制PyQtGraph使用PyQt5
。 設置環境變量后,您可能需要重新啟動Jupyter。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.