导入QtCore时DLL加载失败,QtGui

时间:2017-03-25 20:20:29

标签: pyqt4

人  我最近听说过PyQt4,并决定尝试一下,但是,导入给了我一些错误。当我尝试导入QtCore和QtGui时,我收到了这个错误:

    from PyQt4 import QtCore, QtGui
ImportError: DLL load failed: The specified module could not be found.

我在Windows 32位计算机上使用python 3.6.0 我使用

安装了pyqt4
pip install pyqt4-4.11.4-cp36-cp36m-win32.whl

为了解决这个问题,我查看了我的网站包,我确实看到了

1 个答案:

答案 0 :(得分:0)

您应该使用PyQt5。我知道它没有 QWebView ,但是它有一个名为 QWebEngineView 的附加模块。您可以通过在终端中运行以下命令来安装它: pip install PyQtWebEngine。这是我使用的代码:

import sys
from PyQt5.QtCore import *
from PyQt5.QtWebEngineWidgets import *
from PyQt5.QtWidgets import QApplication

url = "https://stackoverflow.com/"

app = QApplication(sys.argv)
 
web = QWebEngineView()
web.load(QUrl(url))
web.setZoomFactor(2)
web.zoomFactor()
web.show()
 
sys.exit(app.exec_())