Ubuntu安装dlib后import出现libstdc++.so.6: version `GLIBCXX_3.4.21' not found

1 问题描述

先安装依赖包cmake,libboost,再安装dlib

sudo apt-get install cmake

sudo apt-get install libboost-python-dev

sudo pip install dlib

 

安装后import dlib的时候报错

ImportError: /home/liaohuqiang/anaconda2/bin/../lib/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/lib/x86_64-linux-gnu/libboost_python-py27.so.1.58.0)

 

2 原因

升级gcc时,动态库没有替换旧版本gcc的动态库

 

3 解决方法

(1)找到gcc升级时的生成的相应动态库

sudo find / -name "libstdc++.so.6*"

# 某一行:
/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
 
 

 

(2)复制到需要的地方,根据报错信息,把该动态库要放到/home/liaohuqiang/anaconda2/lib下

cp /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21 /home/liaohuqiang/anaconda2/lib

 

(3)建立新的软链接

rm -rf libstdc++.so.6

ln -s libstdc++.so.6.0.21 libstdc++.so.6

 

(4)查看动态库,发现已更新到需要的版本

strings /home/liaohuqiang/anaconda2/lib/libstdc++.so.6.0.21|grep GLIBCXX

 

 

4 推广问题

其它类似出现的问题也可以用这样的方法解决,比如安装opencv后出现的import错误

ImportError: /home/liaohuqiang/anaconda2/bin/../lib/libgomp.so.1: version `GOMP_4.0' not found (required by /usr/lib/x86_64-linux-gnu/libsoxr.so.0)

 

转载于:https://www.cnblogs.com/liaohuiqiang/p/8297389.html

../dlib-19.22/dlib/all/../bigint/../vectorstream/vectorstream.h:31:34: error: invalid use of dependent type ‘dlib::vectorstream::vector_streambuf<CharType>::size_type’ size_type read_pos = 0; // buffer[read_pos] == next byte to read from buffer ^ In file included from ../dlib-19.22/dlib/all/../svm/../global_optimization.h:8:0, from ../dlib-19.22/dlib/all/../svm/auto.cpp:7, from ../dlib-19.22/dlib/all/source.cpp:87: ../dlib-19.22/dlib/all/../svm/../global_optimization/find_max_global.h:284:47: error: default argument missing for parameter 8 of ‘template<class funct, class ... Args> std::pair<long unsigned int, dlib::function_evaluation> dlib::impl::find_max_global(double, dlib::thread_pool&, std::vector<_RealType>&, std::vector<dlib::function_spec>, std::chrono::nanoseconds, dlib::max_function_calls, double, Args&& ...)’ std::pair<size_t,function_evaluation> find_max_global ( ^ ../dlib-19.22/dlib/all/../svm/../global_optimization/find_max_global.h:303:47: error: default argument missing for parameter 7 of ‘template<class funct, class ... Args> std::pair<long unsigned int, dlib::function_evaluation> dlib::impl::find_max_global(double, dlib::thread_pool&, std::vector<_RealType>&, std::vector<dlib::function_spec>, std::chrono::nanoseconds, double, Args&& ...)’ std::pair<size_t,function_evaluation> find_max_global ( ^ make[3]: *** [../dlib-19.22/dlib/all/libRNA_concentrations_la-source.lo] Error 1 make[3]: Leaving directory `/storage/denghua/anaconda3/lib/python3.8/site-packages/ViennaRNA-2.5.0/src/ViennaRNA' make[2]: *** [install-recursive] Error 1 make[2]: Leaving directory `/storage/denghua/anaconda3/lib/python3.8/site-packages/ViennaRNA-2.5.0/src/ViennaRNA' make[1]: *** [install-recursive] Error 1 make[1]: Leaving directory `/storage/denghua/anaconda3/lib/python3.8/site-packages/ViennaRNA-2.5.0/src' make: *** [install-recursive] Error 1
06-06
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值