Cannot import QtWebKitWidgets in PyQt5
QtWebKit
got deprecated upstream in Qt 5.5 and removed in 5.6.
You may want to switch to PyQt5.QtWebEngineWidgets.QWebEngineView.
For basic use of PyQt5.QtWebKitWidgets.QWebView
, it can simply be updated to use PyQt5.QtWebEngineWidgets.QWebEngineView
in the source code, but there may be some differences in the new component which require further adjustments.
QtWebEngineWidgets importError
You may try running it on Python 3.7, if you are using a version later than that. (I've been having this exact error despite following the "fixes" in other posts, but once I used Python 3.7 and PyQt5==5.15.0 my application ran without issue.)
Can't start spyder because of PyQt5.QtWebKitWidgets
I swapped Pyqt5 version from 5.12 to 5.11.2 with:
py -m pip install pyqt5==5.11.2
And now it works...
Python PyQt5 cannot import name 'QWebView'
There are two different web toolkits for Qt5: QtWebKit based on WebKit and the newer QtWebEngine
based on Chromium.
Your imports seem to mix up those two. QWebPage
and QWebView
are part of QtWebKit
, not of QtWebEngine
, which has QWebEngineView
and QWebEnginePage
.
So you can choose either
WebEngine:
from PyQt5.QtWebEngineWidgets import QWebEnginePage
from PyQt5.QtWebEngineWidgets import QWebEngineViewWebKit:
from PyQt5.QtWebKitWidgets import QWebPage
from PyQt5.QtWebKitWidgets import QWebView
The interfaces of those two are largely compatible, but not exactly identical.
Related Topics
Python Library 'Unittest': Generate Multiple Tests Programmatically
Finding Moving Average from Data Points in Python
How to Merge Multiple Lists into One List in Python
How to Add a Custom Loglevel to Python's Logging Facility
Efficient Way to Remove Keys with Empty Strings from a Dict
Multithreaded Web Server in Python
Anaconda/Conda - Install a Specific Package Version
Groupby Column and Filter Rows with Maximum Value in Pyspark
Is There a Difference Between Using a Dict Literal and a Dict Constructor
Finding Occurrences of a Word in a String in Python 3
Fastest Way to Search a List in Python
How Does Python's Comma Operator Work During Assignment
Merging a List of Time-Range Tuples That Have Overlapping Time-Ranges
How to Correctly Parse Utf-8 Encoded HTML to Unicode Strings with Beautifulsoup
Kivy Not Working (Error: Unable to Find Any Valuable Window Provider.)