常见类似问题: ImportError: libxxx: cannot open shared object file: No such file or directory原因1:可能路径未配置正确 解决方法:找到libxxx安装的目录,将目录添加到环境变量LD_LIBRARY_PATH [root@myserver ~]# find / -name libffi*
/usr/local/lib64/libffi.so.6
/root/libffi-3.2.1/x86_64-unknown-linux-gnu/.libs/libffi.so.6
...
[root@myserver~]# echo $LD_LIBRARY_PATH
[root@myserver~]# export LD_LIBRARY_PATH=”/usr/local/lib64/”
原因2: 未安装该库,或版本过低 解决方法: - 查看适配的版本 yum whatprovides libxxx
[root@kefu1013 thoth-ai]# yum whatprovides libXrender.so.1
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.nwsuaf.edu.cn
* extras: mirrors.huaweicloud.com
* updates: ap.stykers.moe
libXrender-0.9.10-1.el7.i686 : X.Org X11 libXrender runtime library
Repo : base
Matched from:
Provides : libXrender.so.1
yum install libXrender-0.9.10-1.el7.i686
- 出现类似错误:ImportError: libxxx: wrong ELF class: ELFCLASS32
安装64位 yum install libXrender-0.9.10-1.el7.x86_64
- 出现类似错误:ImportError: libxxx: wrong ELF class: ELFCLASS64
安装32位 yum install libXrender-0.9.10-1.el7.i686 或 yum install libXrender-0.9.10-1.el7.i386
查看是否为64位文件 file topas /usr/lib/libxxx
卸载已经安装的 yum remove libxxx
常见类似问题:/usr/lib64/libstdc++.so.6: version 'GLIBCXX_3.4.21' not found原因1:已经安装过高版本但未软连接 解决方法:查找编译gcc时生成的最新动态库 find / -name "libstdc++.so*" 输出:
/home/gcc-5.2.0/gcc-temp/stage1-x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so
/home/gcc-5.2.0/gcc-temp/stage1-x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6
/home/gcc-5.2.0/gcc-temp/stage1-x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6.0.21 //最新动态库
……
将最新动态库复制到 /usr/lib64目录下: cp /..../libstdc++.so.6.0.21 /usr/lib64
复制后将新动态库进行软连接: cd /usr/lib64
ln -s libstdc++.so.6.0.21 libstdc++.so.6
原因2:版本低 解决方法: strings /usr/lib64/libstdc++.so.6 | grep GLIBC
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
...
cp libstdc++.so.6.0.17 /usr/lib64/ - 删除libstdc++.so.6符号连接。(也可以不删)
rm libstdc++.so.6 ln -s libstdc++.so.6.0.17 libstdc++.so.6
|