"解决ImportError

Published on Aug. 22, 2023, 12:07 p.m.

首先安装1)

    pip install PyQtWebEngine

2)

    pip install PyQt5==5.11.3

使用QtWebEngineWidgets替换__QtWebKitWidgets__

2In PyQt5 “QtWebKitWidgets” is Deprecated. I just replace this line

from PyQt5.*QtWebKitWidgets* import *QWebView*, *QWebPage*from PyQt5.*QtWebKit* import *QWebSettings*

With this code:

from PyQt5.QtWebEngineWidgets import QWebEngineView as QWebView,QWebEnginePage as QWebPagefrom PyQt5.QtWebEngineWidgets import QWebEngineSettings as QWebSettings

QtWebKitWidgets.QWebView()替换为QtWebEngineWidgets.QWebEngineView()

Tags: