这里使用的QT版本位Pyside2,也可使用PyQt
import sys
from PySide2.QtCore import QUrl
from PySide2.QtWebEngineWidgets import QWebEngineView
from PySide2.QtWidgets import QApplication, QMainWindow
if __name__ == '__main__':
app = QApplication(sys.argv)
mainWin = QMainWindow()
webEngineView = QWebEngineView()
mainWin.setCentralWidget(webEngineView)
initial_url = 'https://www.baidu.com/'
webEngineView.load(QUrl(initial_url))
mainWin.show()
sys.exit(app.exec_())