解决plt.show()闪退
我今天在Linux下进行实验时,发现简单的plt.show()竟然不能显示图片了,一闪就没了。
报错如下: python: relocation error: /home/magic/anaconda2/plugins/xcbglintegrations/libqxcb-glx-integration.so: symbol _ZNK14QXcbConnection12xlib_displayEv, version Qt_5_PRIVATE_API not defined in file libQt5XcbQpa.so.5 with link time reference
在网上并没有搜索到相关解决方法,于是自己仔细看了一下错误提示。发现是libqxcb-glx-integration.so这个文件没有链接到libQt5XcbQpa.so.5,于是解决方案也就来了。
1.首先定位到/home/magic/anaconda2/plugins/xcbglintegrations/libqxcb-glx-integration.so文件
2.利用locate命令定位出libQt5XcbQpa.so.5文件所在目录。我的如下:
/home/magic/anaconda2/envs/flownet2/lib/libQt5XcbQpa.so.5
/home/magic/anaconda2/envs/flownet2/lib/libQt5XcbQpa.so.5.9
/home/magic/anaconda2/envs/flownet2/lib/libQt5XcbQpa.so.5.9.6
/home/magic/anaconda2/envs/tensorflow/lib/libQt5XcbQpa.so.5
/home/magic/anaconda2/envs/tensorflow/lib/libQt5XcbQpa.so.5.6
/home/magic/anaconda2/envs/tensorflow/lib/libQt5XcbQpa.so.5.6.2
/home/magic/anaconda2/lib/libQt5XcbQpa.so.5
/home/magic/anaconda2/lib/libQt5XcbQpa.so.5.6
/home/magic/anaconda2/lib/libQt5XcbQpa.so.5.6.2
/home/magic/anaconda2/pkgs/qt-5.6.2-2/lib/libQt5XcbQpa.so.5
/home/magic/anaconda2/pkgs/qt-5.6.2-2/lib/libQt5XcbQpa.so.5.6
/home/magic/anaconda2/pkgs/qt-5.6.2-2/lib/libQt5XcbQpa.so.5.6.2
/home/magic/anaconda2/pkgs/qt-5.6.2-5/lib/libQt5XcbQpa.so.5
/home/magic/anaconda2/pkgs/qt-5.6.2-5/lib/libQt5XcbQpa.so.5.6
/home/magic/anaconda2/pkgs/qt-5.6.2-5/lib/libQt5XcbQpa.so.5.6.2
/home/magic/anaconda2/pkgs/qt-5.6.2-h974d657_12/lib/libQt5XcbQpa.so.5
/home/magic/anaconda2/pkgs/qt-5.6.2-h974d657_12/lib/libQt5XcbQpa.so.5.6
/home/magic/anaconda2/pkgs/qt-5.6.2-h974d657_12/lib/libQt5XcbQpa.so.5.6.2
/home/magic/anaconda2/pkgs/qt-5.9.6-h8703b6f_2/lib/libQt5XcbQpa.so.5
/home/magic/anaconda2/pkgs/qt-5.9.6-h8703b6f_2/lib/libQt5XcbQpa.so.5.9
/home/magic/anaconda2/pkgs/qt-5.9.6-h8703b6f_2/lib/libQt5XcbQpa.so.5.9.6
/usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5 #找到此目录
/usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5.5
/usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5.5.1
3.利用ln -s软连接两个文件即可。(cd到/home/magic/anaconda2/plugins/xcbglintegrations目录下)
ln -sf /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5 libqxcb-glx-integration.so
非学无以广才,非志无以成学! 【Magic_chao】
posted on 2018-10-10 19:53 Magic_chao 阅读(2909) 评论(0) 编辑 收藏 举报