问题描述
python -c 'from caffe2.python import core' 2>/dev/null && echo "Success" || echo "Failure"
出现这个问题
ERROR: something wrong with flag 'flagfile' in file '/home/bids/softwares/gflags-2.2.0/src/gflags.cc'. One possibility: file '/home/bids/softwares/gflags-2.2.0/src/gflags.cc' is being linked both statically and dynamically into this executable.
这是因为之前设置 Ubuntu 15.04 安装 boost-python , 导致 gflags.cc 指向了
/usr/local/lib/libgflags.a /usr/local/lib/libgflags_nothreads.a 和 /usr/local/include/gflags
caffe2调用gflags会出现矛盾。
解决方法
#Uninstall libgflags
sudo apt-get remove -y libgflags
#Delete make install versions
sudo rm -f /usr/local/lib/libgflags.a /usr/local/lib/libgflags_nothreads.a
sudo rm -rf /usr/local/include/gflags#Re-install libgflags package
sudo apt-get install -y libgflags-dev
参考文献
Caffe Compilation Error: gflags.cc’ is being linked both statically and dynamically into this executable
caffe2 安装与介绍
caffe2