我在尝试运行spyder时遇到这个问题
C:\ProgramData\Anaconda3\Scripts>spyder
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\qtpy\QtWebEngineWidgets.py", line 22, in <module>
from PyQt5.QtWebEngineWidgets import QWebEnginePage
ImportError: DLL load failed while importing QtWebEngineWidgets: The specified module could not be found.
在处理上述异常的过程中,又发生了一个异常:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\Scripts\spyder-script.py", line 10, in <module>
sys.exit(main())
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\app\start.py", line 178, in main
from spyder.app import mainwindow
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 90, in <module>
from qtpy import QtWebEngineWidgets # analysis:ignore
File "C:\ProgramData\Anaconda3\lib\site-packages\qtpy\QtWebEngineWidgets.py", line 26, in <module>
from PyQt5.QtWebKitWidgets import QWebPage as QWebEnginePage
ModuleNotFoundError: No module named 'PyQt5.QtWebKitWidgets'
我已经尝试过https://www.programmersought.com/article/80564836035/的pip安装PyQtWebEngine并卸载PyQt5-stubs
我不使用Spyder,但我遇到了这个问题并设法以某种方式解决了它。
我已经像这样安装了
PyQtWebEngine
:pip install PyQtWebEngine
。但是,这并没有导致创建正确的 Python39\Lib\site-packages\PyQt5\Qt5\bin\Qt5WebEngine.dll
文件。
解决方案:
pip uninstall PyQtWebEngine
pip uninstall PyQtWebEngine-qt5
pip install PyQtWebEngine-qt5
pip install PyQtWebEngine
虽然安装 Qt5 工具的先决条件最终确实安装了,但不知何故搞砸了。首先手动安装它,确保所有东西都放在它应该在的地方。
如果使用pyqt6:
pip install --force-reinstall pyqt6
如果使用pyqt5:
pip install --force-reinstall pyqt5