ImportError: DLL load failed while importing QtWebKit: Le module spécifié est introuvable

ImportError: DLL load failed while importing QtWebKit: Le module spécifié est introuvable

代码:

I don't know why it doesn't run at execution time, knowing that I downloaded all the libraries needed by the program

图书馆 1 :

pip install PyQtWebEngine

图书馆 2 :

pip install PyQt5

这个问题有解决办法吗??

您示例的代码使用 QtWebKit,而不是 Qt WebEngine。如果你已经安装了 pyqtwebengine 然后使用下面的代码:

from PyQt5.QtCore import QUrl
from PyQt5.QtWidgets import QApplication, QSplitter, QVBoxLayout, QWidget
from PyQt5.QtWebEngineWidgets import QWebEngineView


class Window(QWidget):
    def __init__(self, parent=None):
        QWidget.__init__(self, parent=parent)
        self.view = QWebEngineView()
        self.inspector = QWebEngineView()
        self.view.page().setDevToolsPage(self.inspector.page())
        self.splitter = QSplitter(self)
        self.splitter.addWidget(self.view)
        self.splitter.addWidget(self.inspector)
        layout = QVBoxLayout(self)
        layout.addWidget(self.splitter)


if __name__ == "__main__":
    import sys

    app = QApplication(sys.argv)
    window = Window()
    window.view.load(QUrl("http://www.google.com"))
    window.show()
    sys.exit(app.exec_())