错误RuntimeError: the sip module implements API v11.0 to v11.2 but the module requires API v12.0

来源:互联网 发布:天津鹏为软件 编辑:程序博客网 时间:2024/06/10 17:02

参考http://www.cnblogs.com/unicode/p/6063442.html


安装PyQt4.exe,直接运行

import sysfrom PyQt4 import QtGui

会报错:ImportError: DLL load failed: %1 不是有效的 Win32 应用程序。

后来百度要装一个sip程序,才能正常使用PyQt4,,,于是又去官网下载sip,但出现上一篇博客的问题,在上一篇博客已经解决,这里就不写了。

安装sip成功后,运行上面的两行程序,再次报错!大哭

RuntimeError: the sip module implements API v11.0 to v11.2 but the module requires API v12.0

即sip的版本不一

用以下命令分别查询sip的版本


python的版本是sip 4.14.4,而在官网下的是sip 4.19.2

所以删除自己在官网上下载的sip 4.19.2,重新在官网上下载匹配的版本sip 4.14.4

官网:https://riverbankcomputing.com/software/sip/download


之后按照教程重新安装一遍sip

Windows下PyQt4的安装_百度经验
https://jingyan.baidu.com/article/f7ff0bfc16542a2e26bb132b.html




检测是否安装成功,运行以下程序

import sysfrom PyQt4 import QtGuiapp = QtGui.QApplication(sys.argv)widget = QtGui.QWidget()widget.resize(250, 150)widget.setWindowTitle('simple')widget.show()sys.exit(app.exec_())

运行成功!!!




PyQt4至此安装成功!!大笑

4 0
原创粉丝点击