【问题1】libcaffe.so.1.0.0: undefined symbol: _ZN6google4base21CheckOpMessageBuilder9NewStringB5cxx11Ev
【问题2】This program requires version 3.6.1 of the Protocol Buffer runtime li, but the installed version is 2.6.1.
(caffe) jigepeng@user-SYS-7048GR-TR:~/Downloads/protobuf-3.2.0$ protoc
[libprotobuf FATAL google/protobuf/stubs/common.cc:61] This program requires version 3.6.1 of the Protocol Buffer runtime li, but the installed version is 2.6.1. Please update your library. If you compiled the program yourself, make sure that youders are from the same version of Protocol Buffers as your link-time library. (Version verification failed in "google/protony.pb.cc".)
terminate called after throwing an instance of 'google::protobuf::FatalException'
what(): This program requires version 3.6.1 of the Protocol Buffer runtime library, but the installed version is 2.6.1. e update your library. If you compiled the program yourself, make sure that your headers are from the same version of Protouffers as your link-time library. (Version verification failed in "google/protobuf/any.pb.cc".)
Aborted (core dumped)
如何解决:
# 首先你得卸载ubuntu中的protobuf 2.6.1版本(当然你也可以共存安装,详情百度)
# 然后你安装一个protobuf 3.6.1版本,发现还是有如上的问题,解决了一下午后,发现是自己的环境变量的问题
$ sudo gedit ~/.profile
# 修改如下内容
# export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6:/usr/lib/x86_64-linux-gnu/libprotobuf.so.9
# 为
export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6
# 不指定libprotobuf的路径就可以解决了
# 完事了source更新一下
source ~/.profile
# 然后就可以测试protoc是否安装成功
$ protoc --version
# 查看protoc的版本无误,就说明安装成功了
【问题3】caffe重新编译的问题
【问题3.1】TypeError: init() got an unexpected keyword argument ‘syntax’
# 在import caffe后发现如上问题
$ conda uninstall protobuf # 发现失败可以直接安装新的protobuf
# 建议这些操作都是在虚拟环境下进行的,不然会与ubuntu系统本身的发生不可描述的冲突
# 每个人的电脑环境不一致,不能保证一定成功
# 创建虚拟环境命令如下:conda create [env name] python=3.x/2.x
conda install protobuf=3.6.1
# 安装成功后边可以解决
【问题3.2】no module named pywt
conda install pywavelets
【问题3.3】caffe与tensorflow共存的问题
事实证明,在protoc=3.6.1和python=2.7版本下,caffe与tensorflow可以共存
后续会安装python3.x版本的tensorflow与caffe共存的环境
参考这篇
【问题3.4】no module named cv2
在系统中安装python-opencv方法如下:
Ref
在conda中安装python-opencv方法如下:
(caffe) jigepeng@user-SYS-7048GR-TR:~$ conda install -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/linux-64 opencv
Collecting package metadata: done
Solving environment: done
## Package Plan ##
environment location: /home/jigepeng/.conda/envs/caffe
added / updated specs:
- opencv
The following NEW packages will be INSTALLED:
hdf5 anaconda/pkgs/free/linux-64::hdf5-1.8.17-2
jbig anaconda/pkgs/free/linux-64::jbig-2.1-0
jpeg anaconda/pkgs/free/linux-64::jpeg-8d-2
libpng anaconda/pkgs/free/linux-64::libpng-1.6.30-1
libtiff anaconda/pkgs/free/linux-64::libtiff-4.0.6-2
opencv anaconda/pkgs/free/linux-64::opencv-3.1.0-np112py27_1
The following packages will be DOWNGRADED:
numpy 1.13.1-py27_0 --> 1.12.1-py27_0
pywavelets 0.5.2-np113py27_0 --> 0.5.2-np112py27_0
Proceed ([y]/n)? y
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
效果如下:
若tuna镜像用不了,采用pip进行安装
$ pip install opencv-python==3.4.0.14
【放弃Caffe】安装Tensorflow作为Keras的backend
从零开始搭建Ubuntu下的深度学习环境TensorFlow+Keras+Pytorch+Sklearn+OpenCV
Tensorflow官网