Qt4
尽管我已经安装了一些库,但我最近安装Qt5
了,因为应用程序似乎需要Qt4
. 可悲的是,该应用程序也使用mayavi
了 ,现在当它尝试导入其mlab
模块时会出现段错误。我设法将段错误的原因隔离到以下导入,这两者都是导致崩溃的必要条件:
me@Bedrock:~$ 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.
>>> import vtk
>>> from pyface import api as pyface
QMetaType::registerType: Binary compatibility break -- Size mismatch for type 'QUuid' [30]. Previously registered size 16, now registering size 0.
Aborted (core dumped)
me@Bedrock:~$
谷歌搜索导致了一些关于如何设置环境变量的建议.bashrc
:
export QTCHOOSER_RUNTOOL=qtconfig
export QT_SELECT=4
export QT_API='pyside'
export ETS_TOOLKIT='qt4'
我已经使用了这些,有点盲目,但没有成功。
我是否认为我的问题是由于Qt4
/Qt5
冲突引起的,如果是,我应该怎么做?
==================================================== ============================ 我已经进一步调查了。我现在可以通过以下两个导入来实现此崩溃:
me@Bedrock:~/Downloads/temp3/mne-python$ 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 vtk.vtkCommonCore import *
>>> from PySide.QtGui import *
QMetaType::registerType: Binary compatibility break -- Size mismatch for type 'QUuid' [30]. Previously registered size 16, now registering size 0.
Aborted (core dumped)
vtk.vtkCommonCore
包含一行,导入vtkCommonCorePython
,这是一个 .so 文件。
同样,PySide.QtGui
也是一个.so文件。
所以,我的下一步是查看/usr/local/lib/python2.7/dist-packages/PySide/QtGui.so
和/usr/lib/python2.7/dist-packages/vtk/vtkCommonCorePython.x86_64-linux-gnu.so
依赖哪些 .so 文件。
我发现的是这样的:
me@Bedrock:/usr/lib/python2.7/dist-packages/vtk$ ldd -v vtkCommonCorePython.x86_64-linux-gnu.so
linux-vdso.so.1 => (0x00007fff28fc0000)
libvtkCommonCorePython27D-6.2.so.6.2 => /usr/lib/x86_64-linux-gnu/libvtkCommonCorePython27D-6.2.so.6.2 (0x00007f0488925000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f04885a2000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f04881d9000)
libvtkWrappingPython27Core-6.2.so.6.2 => /usr/lib/x86_64-linux-gnu/libvtkWrappingPython27Core-6.2.so.6.2 (0x00007f0487fac000)
libvtkCommonCore-6.2.so.6.2 => /usr/lib/x86_64-linux-gnu/libvtkCommonCore-6.2.so.6.2 (0x00007f0487a7d000)
libpython2.7.so.1.0 => /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0 (0x00007f04874ef000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f04871e6000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f0486fcf000)
/lib64/ld-linux-x86-64.so.2 (0x000055b9eee1f000)
libvtksys-6.2.so.6.2 => /usr/lib/x86_64-linux-gnu/libvtksys-6.2.so.6.2 (0x00007f0486d8a000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f0486b6c000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f0486952000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f048674e000)
libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f048654a000)
和这个:
me@Bedrock:/usr/local/lib/python2.7/dist-packages/PySide$ ldd -v /usr/local/lib/python2.7/dist-packages/PySide/QtGui.so
linux-vdso.so.1 => (0x00007fff37bfc000)
libpyside-python2.7.so.1.2 (0x00007ff4672cf000)
libpython2.7.so.1.0 => /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0 (0x00007ff466cfa000)
libshiboken-python2.7.so.1.2 (0x00007ff466ac6000)
libQtGui.so.4 => /usr/lib/x86_64-linux-gnu/libQtGui.so.4 (0x00007ff465dd2000)
libQtCore.so.4 => /usr/lib/x86_64-linux-gnu/libQtCore.so.4 (0x00007ff4658de000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007ff46555c000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007ff465346000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ff464f7c000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007ff464d5f000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007ff464b45000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007ff464940000)
libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007ff46473d000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007ff464434000)
libfontconfig.so.1 => /usr/lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007ff4641f0000)
libaudio.so.2 => /usr/lib/x86_64-linux-gnu/libaudio.so.2 (0x00007ff463fd7000)
libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007ff463cc6000)
libpng12.so.0 => /lib/x86_64-linux-gnu/libpng12.so.0 (0x00007ff463aa0000)
libfreetype.so.6 => /usr/lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007ff4637f6000)
libgobject-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 (0x00007ff4635a3000)
libSM.so.6 => /usr/lib/x86_64-linux-gnu/libSM.so.6 (0x00007ff46339a000)
libICE.so.6 => /usr/lib/x86_64-linux-gnu/libICE.so.6 (0x00007ff463180000)
libXi.so.6 => /usr/lib/x86_64-linux-gnu/libXi.so.6 (0x00007ff462f70000)
libXrender.so.1 => /usr/lib/x86_64-linux-gnu/libXrender.so.1 (0x00007ff462d65000)
libXext.so.6 => /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007ff462b53000)
libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007ff462819000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007ff462610000)
/lib64/ld-linux-x86-64.so.2 (0x000055bd99ece000)
libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007ff4623e7000)
libXt.so.6 => /usr/lib/x86_64-linux-gnu/libXt.so.6 (0x00007ff46217d000)
libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007ff461f79000)
libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007ff461d09000)
libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007ff461b00000)
libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007ff4618fb000)
libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007ff4616d8000)
libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007ff4614d2000)
只有/usr/local/lib/python2.7/dist-packages/PySide/QtGui.so
似乎与 Qt 库有任何直接联系,所以我不明白vtk
导入如何/为什么会干扰任何与 Qt 相关的内容。
最后,我开始好奇这些/usr/lib/x86_64-linux-gnu/libQt...so
文件使用的是哪个版本的 Qt。所以,我尝试了这个:
me@Bedrock:~$ qmake --version
QMake version 2.01a
Using Qt version 4.8.7 in /usr/lib/x86_64-linux-gnu
我还检查了我的版本vtk
>>> vtk.VTK_MAJOR_VERSION
6
>>> vtk.VTK_MINOR_VERSION
2
>>>
以及我的 PySide 版本:
>>> import PySide
>>> PySide.__version__
'1.2.4'
在这一点上,我只是更加困惑。我的问题是 Qt4/Qt5 冲突吗?(我认为是这样)如果不是,为什么我会收到带有错误的 Seg Faults:
QMetaType::registerType: Binary compatibility break -- Size mismatch for type 'QUuid' [30]. Previously registered size 16, now registering size 0.
Aborted (core dumped)
如果是这样,为什么我似乎只使用一个版本的 Qt?最重要的是,我该如何解决这个问题?