今天想在macOS Catalina(10.15.4)系统上,测试一下Python下的QT界面操作,结果在执行
1 |
from PyQt5 import QtWebEngineWidgets |
的时候,报告如下错误:
1 2 3 4 |
Exception has occurred: ImportError cannot import name 'QtWebEngineWidgets' from 'PyQt5' (/usr/local/lib/python3.7/site-packages/PyQt5/__init__.py) File "demoUI.py", line 10, in <module> from PyQt5 import QtWebEngineWidgets |
也有可能报告:
1 |
No module named PyQt5.QtWebEngineWidgets |
查了好久才在Stack Overflow上找到一个回答,说是这个模块被PyQt5移除了,需要单独安装。
安装命令为:
1 |
$ pip install PyQtWebEngine |
参考链接
Python-PyQt5-PyQtWebEngine采坑记录-- No module named PyQt5.QtWebEngineWidgets