menu

解决ImportError: cannot import name 'QtWebKitWidgets'错误

首先安装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()
编辑