系统安装了python 2.7,继续安装PyQt4,于是依次下载sip、pyqt4源码进行安装。用以下代码测试:

import PyQt4.QtGui

显示出错。错误信息:the sip module implements API v??? but XXX module requires API v???

分别用

import sip

print(sip, sip.SIP_VERSION_STR)

sip -V

查看sip的版本,发现版本不同,前者版本较低。

解决办法:根据print(sip, sip.SIP_VERSION_STR)显示的sip位置(如/usr/lib/python2.7/dist_package)将文件夹中所有sip开头的文件删除

sudo rm -f sip*

然后,重新用源码安装

python configure.y

make

make install

问题解决!

 

相关文章:

  • 2021-06-25
  • 2022-01-08
  • 2022-12-23
  • 2021-11-22
  • 2021-09-09
  • 2021-10-31
  • 2021-06-22
  • 2021-05-27
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-06-13
  • 2021-05-06
  • 2022-12-23
  • 2021-07-03
  • 2021-07-31
相关资源
相似解决方案