从PyQt5导入Qt会产生分段错误。在
$ python
Python 2.7.12 (default, Nov 19 2016, 06:48:10)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyQt5 import Qt
[1] 7667 segmentation fault (core dumped) python
使用GDB运行可以提供更多信息。在
^{pr2}$编辑:由于版本控制的原因,我不得不从源代码编译PyQt5。下面是PyQt配置脚本中的full output。以下是缩略版本。在
$ python configure.py --verbose --qmake=/home/jeff/Qt/5.9.2/gcc_64/bin/qmake
Querying qmake about your Qt installation...
Determining the details of your Qt installation...
/home/jeff/Qt/5.9.2/gcc_64/bin/qmake -o cfgtest_QtCore.mk cfgtest_QtCore.pro
Info: creating stash file /home/jeff/Downloads/PyQt5_gpl-5.9/.qmake.stash
make -f cfgtest_QtCore.mk
g++ -c -pipe -O2 -std=gnu++11 -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_CORE_LIB -I. -I../../Qt/5.9.2/gcc_64/include -I../../Qt/5.9.2/gcc_64/include/QtCore -I. -I../../Qt/5.9.2/gcc_64/mkspecs/linux-g++ -o cfgtest_QtCore.o config-tests/cfgtest_QtCore.cpp
g++ -Wl,-O1 -Wl,-rpath,/home/jeff/Qt/5.9.2/gcc_64/lib -o cfgtest_QtCore cfgtest_QtCore.o -L/home/jeff/Qt/5.9.2/gcc_64/lib -lQt5Core -lpthread
./cfgtest_QtCore cfgtest_QtCore.out
This is the GPL version of PyQt 5.9 (licensed under the GNU General Public
License) for Python 2.7.12 on linux2.
Type 'L' to view the license.
Type 'yes' to accept the terms of the license.
Type 'no' to decline the terms of the license.
Do you accept the terms of the license? yes
Found the license file pyqt-gpl.sip.
Checking to see if the QtGui module should be built...
/home/jeff/Qt/5.9.2/gcc_64/bin/qmake -o cfgtest_QtGui.mk cfgtest_QtGui.pro
make -f cfgtest_QtGui.mk
g++ -c -pipe -O2 -std=gnu++11 -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I. -I../../Qt/5.9.2/gcc_64/include -I../../Qt/5.9.2/gcc_64/include/QtGui -I../../Qt/5.9.2/gcc_64/include/QtCore -I. -isystem /usr/include/libdrm -I../../Qt/5.9.2/gcc_64/mkspecs/linux-g++ -o cfgtest_QtGui.o config-tests/cfgtest_QtGui.cpp
g++ -Wl,-O1 -Wl,-rpath,/home/jeff/Qt/5.9.2/gcc_64/lib -o cfgtest_QtGui cfgtest_QtGui.o -L/home/jeff/Qt/5.9.2/gcc_64/lib -lQt5Gui -lQt5Core -lGL -lpthread
./cfgtest_QtGui cfgtest_QtGui.out
...
Checking to see if the QtWebKit module should be built...
/home/jeff/Qt/5.9.2/gcc_64/bin/qmake -o cfgtest_QtWebKit.mk cfgtest_QtWebKit.pro
Project ERROR: Unknown module(s) in QT: webkit
Checking to see if the QtWebKitWidgets module should be built...
/home/jeff/Qt/5.9.2/gcc_64/bin/qmake -o cfgtest_QtWebKitWidgets.mk cfgtest_QtWebKitWidgets.pro
Project ERROR: Unknown module(s) in QT: webkitwidgets
...
Checking to see if the QAxContainer module should be built...
/home/jeff/Qt/5.9.2/gcc_64/bin/qmake -o cfgtest_QAxContainer.mk cfgtest_QAxContainer.pro
Project ERROR: Unknown module(s) in QT: axcontainer
...
Checking to see if the QtMacExtras module should be built...
/home/jeff/Qt/5.9.2/gcc_64/bin/qmake -o cfgtest_QtMacExtras.mk cfgtest_QtMacExtras.pro
Project ERROR: Unknown module(s) in QT: macextras
...
Checking to see if the QtWinExtras module should be built...
/home/jeff/Qt/5.9.2/gcc_64/bin/qmake -o cfgtest_QtWinExtras.mk cfgtest_QtWinExtras.pro
Project ERROR: Unknown module(s) in QT: winextras
...
Checking to see if the Enginio module should be built...
/home/jeff/Qt/5.9.2/gcc_64/bin/qmake -o cfgtest_Enginio.mk cfgtest_Enginio.pro
Project ERROR: Unknown module(s) in QT: enginio
...
Checking to see if the QtWebEngine module should be built...
/home/jeff/Qt/5.9.2/gcc_64/bin/qmake -o cfgtest_QtWebEngine.mk cfgtest_QtWebEngine.pro
make -f cfgtest_QtWebEngine.mk
g++ -c -pipe -O2 -std=gnu++11 -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_WEBENGINE_LIB -DQT_WEBENGINECORE_LIB -DQT_QUICK_LIB -DQT_GUI_LIB -DQT_WEBCHANNEL_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_POSITIONING_LIB -DQT_CORE_LIB -I. -I../../Qt/5.9.2/gcc_64/include -I../../Qt/5.9.2/gcc_64/include/QtWebEngine -I../../Qt/5.9.2/gcc_64/include/QtWebEngineCore -I../../Qt/5.9.2/gcc_64/include/QtQuick -I../../Qt/5.9.2/gcc_64/include/QtGui -I../../Qt/5.9.2/gcc_64/include/QtWebChannel -I../../Qt/5.9.2/gcc_64/include/QtQml -I../../Qt/5.9.2/gcc_64/include/QtNetwork -I../../Qt/5.9.2/gcc_64/include/QtPositioning -I../../Qt/5.9.2/gcc_64/include/QtCore -I. -isystem /usr/include/libdrm -I../../Qt/5.9.2/gcc_64/mkspecs/linux-g++ -o cfgtest_QtWebEngine.o cfgtest_QtWebEngine.cpp
cfgtest_QtWebEngine.cpp: In function ‘int main(int, char**)’:
cfgtest_QtWebEngine.cpp:5:17: warning: unused variable ‘v’ [-Wunused-variable]
const char *v = QTWEBENGINE_VERSION_STR;
^
g++ -Wl,-O1 -Wl,-rpath,/home/jeff/Qt/5.9.2/gcc_64/lib -Wl,-rpath-link,/home/jeff/Qt/5.9.2/gcc_64/lib -o cfgtest_QtWebEngine cfgtest_QtWebEngine.o -L/home/jeff/Qt/5.9.2/gcc_64/lib -lQt5WebEngine -lQt5WebEngineCore -lQt5Quick -lQt5Gui -lQt5WebChannel -lQt5Qml -lQt5Network -lQt5Positioning -lQt5Core -lGL -lpthread
Checking to see if the dbus support module should be built...
pkg-config --cflags-only-I --libs dbus-1
Qt v5.9.2 is being used.
The qmake executable is /home/jeff/Qt/5.9.2/gcc_64/bin/qmake.
Qt is built as a shared library.
SIP 4.19.3 is being used.
The sip executable is /usr/bin/sip.
These PyQt5 modules will be built: QtCore, QtGui, QtHelp, QtMultimedia,
QtMultimediaWidgets, QtNetwork, QtOpenGL, QtPrintSupport, QtQml, QtQuick,
QtSql, QtSvg, QtTest, QtWidgets, QtXml, QtXmlPatterns, QtDesigner, QtDBus,
_QOpenGLFunctions_2_0, _QOpenGLFunctions_2_1, _QOpenGLFunctions_4_1_Core,
QtSensors, QtSerialPort, QtX11Extras, QtBluetooth, QtPositioning,
QtQuickWidgets, QtWebSockets, QtWebChannel, QtWebEngineWidgets, QtLocation,
QtNfc, QtWebEngineCore, QtWebEngine.
The PyQt5 Python package will be installed in /usr/lib/python2.7/dist-packages.
PyQt5 is being built with generated docstrings.
PyQt5 is being built with 'protected' redefined as 'public'.
The Designer plugin will be installed in
/home/jeff/Qt/5.9.2/gcc_64/plugins/designer.
The qmlscene plugin will be installed in
/home/jeff/Qt/5.9.2/gcc_64/plugins/PyQt5.
The dbus support module will be installed in
/usr/local/lib/python2.7/dist-packages/dbus/mainloop.
The PyQt5 .sip files will be installed in /usr/share/sip/PyQt5.
pyuic5, pyrcc5 and pylupdate5 will be installed in /usr/bin.
The interpreter used by pyuic5 is /usr/bin/python.
Generating the C++ source for the QtCore module...
/usr/bin/sip -w -f -x VendorID -t WS_X11 -t Qt_5_9_2 -x Py_v3 -B Qt_6_0_0 -P -o -c /home/jeff/Downloads/PyQt5_gpl-5.9/QtCore -I sip -I /home/jeff/Downloads/PyQt5_gpl-5.9/sip /home/jeff/Downloads/PyQt5_gpl-5.9/sip/QtCore/QtCoremod.sip
Embedding sip flags...
Generating the .pro file for the QtCore module...
Generating the C++ source for the QtGui module...
/usr/bin/sip -w -f -x VendorID -t WS_X11 -t Qt_5_9_2 -x Py_v3 -B Qt_6_0_0 -P -o -c /home/jeff/Downloads/PyQt5_gpl-5.9/QtGui -I sip -I /home/jeff/Downloads/PyQt5_gpl-5.9/sip /home/jeff/Downloads/PyQt5_gpl-5.9/sip/QtGui/QtGuimod.sip
...
Generating the .pro file for the pyrcc module...
Generating the C++ source for the Qt module...
/usr/bin/sip -w -f -x VendorID -t WS_X11 -t Qt_5_9_2 -x Py_v3 -B Qt_6_0_0 -P -c /home/jeff/Downloads/PyQt5_gpl-5.9/Qt -I sip -I /home/jeff/Downloads/PyQt5_gpl-5.9/sip sip/Qt/Qtmod.sip
Generating the .pro file for the Qt module...
Generating the pylupdate5 wrapper...
Generating the pyrcc5 wrapper...
Generating the pyuic5 wrapper...
Generating the Qt Designer plugin .pro file...
Generating the qmlscene plugin .pro file...
Re-writing
/home/jeff/Downloads/PyQt5_gpl-5.9/examples/quick/tutorials/extending/chapter6-plugins/Charts/qmldir...
Generating the .pro file for the dbus module...
Generating the top-level .pro file...
Making the pylupdate5 wrapper executable...
Making the pyrcc5 wrapper executable...
Making the pyuic5 wrapper executable...
Generating the Makefiles...
/home/jeff/Qt/5.9.2/gcc_64/bin/qmake -recursive PyQt5.pro
Reading /home/jeff/Downloads/PyQt5_gpl-5.9/QtCore/QtCore.pro
Reading /home/jeff/Downloads/PyQt5_gpl-5.9/QtGui/QtGui.pro
Reading /home/jeff/Downloads/PyQt5_gpl-5.9/QtHelp/QtHelp.pro
Reading /home/jeff/Downloads/PyQt5_gpl-5.9/QtMultimedia/QtMultimedia.pro
Reading /home/jeff/Downloads/PyQt5_gpl-5.9/QtMultimediaWidgets/QtMultimediaWidgets.pro
Reading /home/jeff/Downloads/PyQt5_gpl-5.9/QtNetwork/QtNetwork.pro
Reading /home/jeff/Downloads/PyQt5_gpl-5.9/QtOpenGL/QtOpenGL.pro
Reading /home/jeff/Downloads/PyQt5_gpl-5.9/QtPrintSupport/QtPrintSupport.pro
Reading /home/jeff/Downloads/PyQt5_gpl-5.9/QtQml/QtQml.pro
Reading /home/jeff/Downloads/PyQt5_gpl-5.9/QtQuick/QtQuick.pro
Reading /home/jeff/Downloads/PyQt5_gpl-5.9/QtSql/QtSql.pro
Reading /home/jeff/Downloads/PyQt5_gpl-5.9/QtSvg/QtSvg.pro
Reading /home/jeff/Downloads/PyQt5_gpl-5.9/QtTest/QtTest.pro
Reading /home/jeff/Downloads/PyQt5_gpl-5.9/QtWidgets/QtWidgets.pro
Reading /home/jeff/Downloads/PyQt5_gpl-5.9/QtXml/QtXml.pro
Reading /home/jeff/Downloads/PyQt5_gpl-5.9/QtXmlPatterns/QtXmlPatterns.pro
Reading /home/jeff/Downloads/PyQt5_gpl-5.9/QtDesigner/QtDesigner.pro
Reading /home/jeff/Downloads/PyQt5_gpl-5.9/QtDBus/QtDBus.pro
Reading /home/jeff/Downloads/PyQt5_gpl-5.9/_QOpenGLFunctions_2_0/_QOpenGLFunctions_2_0.pro
Reading /home/jeff/Downloads/PyQt5_gpl-5.9/_QOpenGLFunctions_2_1/_QOpenGLFunctions_2_1.pro
Reading /home/jeff/Downloads/PyQt5_gpl-5.9/_QOpenGLFunctions_4_1_Core/_QOpenGLFunctions_4_1_Core.pro
Reading /home/jeff/Downloads/PyQt5_gpl-5.9/QtSensors/QtSensors.pro
Reading /home/jeff/Downloads/PyQt5_gpl-5.9/QtSerialPort/QtSerialPort.pro
Reading /home/jeff/Downloads/PyQt5_gpl-5.9/QtX11Extras/QtX11Extras.pro
Reading /home/jeff/Downloads/PyQt5_gpl-5.9/QtBluetooth/QtBluetooth.pro
Reading /home/jeff/Downloads/PyQt5_gpl-5.9/QtPositioning/QtPositioning.pro
Reading /home/jeff/Downloads/PyQt5_gpl-5.9/QtQuickWidgets/QtQuickWidgets.pro
Reading /home/jeff/Downloads/PyQt5_gpl-5.9/QtWebSockets/QtWebSockets.pro
Reading /home/jeff/Downloads/PyQt5_gpl-5.9/QtWebChannel/QtWebChannel.pro
Reading /home/jeff/Downloads/PyQt5_gpl-5.9/QtWebEngineWidgets/QtWebEngineWidgets.pro
Reading /home/jeff/Downloads/PyQt5_gpl-5.9/QtLocation/QtLocation.pro
Reading /home/jeff/Downloads/PyQt5_gpl-5.9/QtNfc/QtNfc.pro
Reading /home/jeff/Downloads/PyQt5_gpl-5.9/QtWebEngineCore/QtWebEngineCore.pro
Reading /home/jeff/Downloads/PyQt5_gpl-5.9/QtWebEngine/QtWebEngine.pro
Reading /home/jeff/Downloads/PyQt5_gpl-5.9/pylupdate/pylupdate.pro
Reading /home/jeff/Downloads/PyQt5_gpl-5.9/pyrcc/pyrcc.pro
Reading /home/jeff/Downloads/PyQt5_gpl-5.9/Qt/Qt.pro
Reading /home/jeff/Downloads/PyQt5_gpl-5.9/designer/designer.pro
Reading /home/jeff/Downloads/PyQt5_gpl-5.9/qmlscene/qmlscene.pro
Reading /home/jeff/Downloads/PyQt5_gpl-5.9/dbus/dbus.pro
PyQt应该忽略它无法识别的Qt模块,因为这些模块在qt5.x版本中不具有兼容性,所以“未知模块”位并不太重要。在
我用的是:
我在另一个安装程序(Slackware)上遇到了同样的问题,这导致Openshot在启动时无声地崩溃。在
原因是升级安装了来自不同来源的包(slackonly和alienbob)。在
通过搜索以“qt5”和“qt5”命名的包,我可以识别出错误的包并用相关的版本替换它们,这就解决了这个问题。在
机器上有一个旧版本的SIP,正在导入,而不是从源代码构建的用于构建PyQt的新版本。删除旧版本的SIP解决了这个问题。在
以前
使用
^{pr2}$sudo apt remove python-sip
删除旧版本后相关问题 更多 >
编程相关推荐