系统安装了python 2.7,继续安装PyQt4,因而依次下载sip、pyqt4源码进行安装。用如下代码测试:python
import PyQt4.QtGuipython2.7
显示出错。错误信息:the sip module implements API v??? but XXX module requires API v???测试
分别用ui
import sipip
print(sip, sip.SIP_VERSION_STR)源码
和qt
sip -Vimport
查看sip的版本,发现版本不一样,前者版本较低。require
解决办法:根据print(sip, sip.SIP_VERSION_STR)显示的sip位置(如/usr/lib/python2.7/dist_package)将文件夹中全部sip开头的文件删除module
sudo rm -f sip*
而后,从新用源码安装
python configure.y
make
make install
问题解决!