安装PyQt 5.4.2时发生错误:sip api参考。

3

我需要帮助弄清楚为什么会出现这个错误:

[everything fine until here...]
In file included from sipQtCoreQTimeZoneOffsetData.cpp:24:0:
/home/hugo/Desktop/my_pyqt_examples/PyQt-gpl-5.4.2/QtCore/sipQtCoreQTimeZoneOffsetData.cpp: In function ‘PyObject* varget_QTimeZone_OffsetData_abbreviation(void*, PyObject*, PyObject*)’:
/home/hugo/Desktop/my_pyqt_examples/PyQt-gpl-5.4.2/QtCore/sipAPIQtCore.h:9581:52: error: ‘const sipAPIDef’ has no member named ‘api_get_reference’
 #define sipGetReference             sipAPI_QtCore->api_get_reference
                                                    ^
/home/hugo/Desktop/my_pyqt_examples/PyQt-gpl-5.4.2/QtCore/sipQtCoreQTimeZoneOffsetData.cpp:128:13: note: in expansion of macro ‘sipGetReference’
     sipPy = sipGetReference(sipPySelf, -13);
             ^
/home/hugo/Desktop/my_pyqt_examples/PyQt-gpl-5.4.2/QtCore/sipQtCoreQTimeZoneOffsetData.cpp: In function ‘PyObject* varget_QTimeZone_OffsetData_atUtc(void*, PyObject*, PyObject*)’:
/home/hugo/Desktop/my_pyqt_examples/PyQt-gpl-5.4.2/QtCore/sipAPIQtCore.h:9581:52: error: ‘const sipAPIDef’ has no member named ‘api_get_reference’
 #define sipGetReference             sipAPI_QtCore->api_get_reference
                                                    ^
/home/hugo/Desktop/my_pyqt_examples/PyQt-gpl-5.4.2/QtCore/sipQtCoreQTimeZoneOffsetData.cpp:170:13: note: in expansion of macro ‘sipGetReference’
     sipPy = sipGetReference(sipPySelf, -14);
             ^
make[1]: *** [sipQtCoreQTimeZoneOffsetData.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory `/home/hugo/Desktop/my_pyqt_examples/PyQt-gpl-5.4.2/QtCore'
make: *** [sub-QtCore-make_first-ordered] Error 2

我正在Ubuntu 14.04的虚拟环境中安装PyQt 5.4。我已经安装了SIP(版本4.16.8,which sip返回的是虚拟环境内的版本)。在配置运行期间似乎一切都很顺利:

python configure.py --qmake /home/hugo/Qt/5.4/gcc_64/bin/qmake

输出结果(包括其他内容):

Qt v5.4.2 (Open Source) is being used.
The qmake executable is /home/hugo/Qt/5.4/gcc_64/bin/qmake.
Qt is built as a shared library.
SIP 4.16.8 is being used.
The sip executable is /home/hugo/Desktop/my_pyqt_examples/venv/bin/sip.
These PyQt5 modules will be built: QtCore, QtGui, QtHelp, QtMultimedia,
QtMultimediaWidgets, QtNetwork, QtOpenGL, QtPrintSupport, QtQml, QtQuick,
QtSql, QtSvg, QtTest, QtWebKit, QtWebKitWidgets, QtWidgets, QtXml,
QtXmlPatterns, QtDesigner, QtDBus, _QOpenGLFunctions_2_0,
_QOpenGLFunctions_2_1, _QOpenGLFunctions_4_1_Core, QtSensors, QtSerialPort,
QtX11Extras, QtBluetooth, QtPositioning, QtQuickWidgets, QtWebSockets, Enginio,
QtWebChannel, QtWebEngineWidgets.
The PyQt5 Python package will be installed in
/home/hugo/Desktop/my_pyqt_examples/venv/lib/python3.4/site-packages

告诉我是否需要更多信息。我也尝试使用Ubuntu仓库的qt版本重新安装PyQt 5.2,但是我遇到了同样的错误。我该怎么办?
编辑:我使用sip 4.16.7成功解决了这个问题。但我认为这并不是解决方法,如果有人知道为什么最新版本无法工作,请详细说明。
1个回答

1
我遇到了同样的问题,通过在make步骤之前指定sip路径来解决了它: python configure.py --sip-incdir=/opt/sip-4.6.9/include/python2.7

干杯,伙计。设置正确的“--sip-incdir”就可以了。 - K3---rnc
我自己没有测试过这个解决方案,但由于@K3---rnc报告说它有效,所以我将把它标记为答案。 - Hugo

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接