PyQt5 - SIP API 10级错误。需要API 11 [英] PyQt5 - SIP API 10 level error. API 11 required

查看:928
本文介绍了PyQt5 - SIP API 10级错误。需要API 11的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

反馈

我正在进行PyQt5安装(基于Qt5.2.1 / Sip 4.15.5 API 11 ??? )使用符合PyQt5(> = 3.3.2)的标准Python3(3.3.2+)解释器,因为无法在Ubuntu 12.04上编译Python3.3-5,然后无法安装PyQt5(python 3.3.2或更高版本) )。

I'm working on a PyQt5 installation (based on Qt5.2.1 / Sip 4.15.5 API 11 ???) with the standard Python3 (3.3.2+) interpreter that is PyQt5 compliant (>= 3.3.2) as It's not possible to compile Python3.3-5 on Ubuntu 12.04 and then impossible to install PyQt5 (python 3.3.2 or later).

平台

jeby6372@mercure:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 13.10
Release:    13.10
Codename:   saucy
jeby6372@mercure:~$ uname -a
Linux mercure 3.11.0-13-generic #20-Ubuntu SMP Wed Oct 23 07:38:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

安装过程中似乎一切正常,PyQt5导入有效,但是当我尝试通过python3解释器导入模块时,会出现此错误:

Everything seemed to work fine during the installation, the PyQt5 import works but when I try a module import thru the python3 interpreter, this error is raised:

>>> import PyQt5
>>> from PyQt5.QtCore import *
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
RuntimeError: the sip module implements API v10.0 to v10.1 but the PyQt5.QtCore module requires API v11.0

安装步骤:


  • Qt5.2.1与标准X64 linux安装程序一起安装

  • SIP 4.15.5从源代码安装

  • PyQt5来自RiverBank程序中提到的编译源,目标是编译中的qmake程序.py选项:

  • Qt5.2.1 installed with the standard X64 linux installer
  • SIP 4.15.5 installation from sources
  • PyQt5 from sources compiled as mentioned in the RiverBank procedure, targeting the qmake program in the compile.py options :

python3 configure.py --qmake /opt/Qt/5.2.1/gcc_64/bin/qmake --sip / usr / bin / sip

python3 configure.py --qmake /opt/Qt/5.2.1/gcc_64/bin/qmake --sip /usr/bin/sip

套餐地点:


  • Qt-5.2.1根目录: /opt/Qt/5.2.1/gcc_64

  • PyQt5根目录: /usr/lib/python3.3/site-packages

  • Qt-5.2.1 root directory : /opt/Qt/5.2.1/gcc_64
  • PyQt5 root directory : /usr/lib/python3.3/site-packages

啜饮版

jeby6372@mercure:~$ which sip
/usr/bin/sip
jeby6372@mercure:~$ sip -V
4.15.5
jeby6372@mercure:~$ 

我的python环境变量是:

My python environment variable is :

jeby6372@mercure:~$ echo $PYTHONPATH
/usr/lib/python3.3/site-packages

$ PATH可变:

jeby6372@mercure:~$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/opt/Qt/5.2.1/gcc_64/bin

$ LD_LIBRARY_PATH为空(不要我认为这很重要,但我更愿意提及......)

$LD_LIBRARY_PATH is empty (don't think it's important but I prefer to mention it... )

网站 - pacakges目录的内容是:

The content of the site-pacakges dir is :

jeby6372@mercure:~$ ls /usr/lib/python3.3/site-packages
PyQt5

__init__.py  QtCore.so  QtDBus.so  QtNetwork.so  Qt.so  QtXmlPatterns.so  uic

但在之前的安装中是不同的。不知道为什么! :

but in a previous installation it was different. Don't know why ! :

jeby6372@mercure:~$ ls /usr/lib/python3.3/site-packages/PyQt5
__init__.py               QtDesigner.so           QtNetwork.so       QtQuick.so       QtSvg.so        QtXmlPatterns.so
_QOpenGLFunctions_2_0.so  QtGui.so                QtOpenGL.so        QtSensors.so     QtTest.so       uic
QtBluetooth.so            QtHelp.so               QtPositioning.so   QtSerialPort.so  QtWebKit.so
QtCore.so                 QtMultimedia.so         QtPrintSupport.so  Qt.so            QtWidgets.so
QtDBus.so                 QtMultimediaWidgets.so  QtQml.so           QtSql.so         QtX11Extras.so

我无法弄清问题在哪里,我对这个产品的处理越多,我理解的越少。我正在Ubuntu 13.10上进行此安装,因为由于Python 3.3-5编译错误,PyQt5无法在Ubuntu 12.04上运行..仍然没有答案。 ...

I can't figure out where the problem is, The more I work on this product the less I understand. I'm doing this installation on Ubuntu 13.10 because PyQt5 doesn't work on Ubuntu 12.04 due to Python 3.3-5 compilation errors .. Still with no answer yet. ...

请帮忙。

提前致谢。

推荐答案

你的问题来自于分发提供的sip和你可能从源代码编译的sip的冲突。

Your problem comes from a clash of the distribution-supplied sip and the sip you probably compiled from sources.

由用户mata吸收,请致电 import sip;从python3解释器控制台中打印(sip,sip.SIP_VERSION_STR)并将输出与从调用 sip -V 中获得的输出进行比较普通(bash)控制台。版本可能不同。

As sugested by user mata, call import sip; print(sip, sip.SIP_VERSION_STR) from within a python3 interpreter console and compare the output to the one you get from calling sip -V from a normal (bash) console. The versions probably differ.

我通过识别系统中所有已安装的sip相关软件包克服了这个错误。 (对于类似Debian的系统: dpkg -l | grep sip ),删除它们及其所有配置文件(同样,对于Debian: apt-get清除python3-sip python3-sip-dev ...)并重新安装自定义版本(再次运行 make install )。

I overcame that error by identifying all installed sip-related packages in my system. (For Debian-like systems: dpkg -l | grep sip), removed them and all their configuration files (again, for Debian: apt-get purge python3-sip python3-sip-dev ...) and re-installed the custom version (by running make install again).

顺便提一下,我对所有PyQt5软件包都做了同样的事情。根据您不完整的站点包列表,您可能还安装了一些较旧的PyQt5发行版包。
当前的模块有更多模块。 (例如QtSql)

I by the way also did the same for all PyQt5 packages. According to your incomplete site-packages listing, you also might have installed some older PyQt5 distro package. The current one has many more modules. (QtSql for instance)

(所有提到的命令都应该以root身份执行。)

(All mentioned command should probably be executed as root.)

这篇关于PyQt5 - SIP API 10级错误。需要API 11的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆