编译pycaffe错误 --#error This file was generated by a newer version of protoc

来源:互联网 发布:天下三捏脸数据女bx 编辑:程序博客网 时间:2024/06/05 03:25

在编译py-faster-rcnn的pycaffe时出现以上错误:

CXX .build_release/src/caffe/proto/caffe.pb.ccCXX src/caffe/blob.cppCXX src/caffe/data_transformer.cppCXX src/caffe/net.cppCXX src/caffe/solver.cppCXX src/caffe/util/insert_splits.cppCXX src/caffe/util/db.cppCXX src/caffe/util/upgrade_proto.cppIn file included from .build_release/src/caffe/proto/caffe.pb.cc:5:0:.build_release/src/caffe/proto/caffe.pb.h:12:2: error: #error This file was generated by a newer version of protoc which is #error This file was generated by a newer version of protoc which is  ^.build_release/src/caffe/proto/caffe.pb.h:13:2: error: #error incompatible with your Protocol Buffer headers. Please update #error incompatible with your Protocol Buffer headers.  Please update  ^.build_release/src/caffe/proto/caffe.pb.h:14:2: error: #error your headers. #error your headers.  ^.build_release/src/caffe/proto/caffe.pb.h:22:35: fatal error: google/protobuf/arena.h: 没有那个文件或目录 #include <google/protobuf/arena.h>                                   ^compilation terminated.


原因: it is because of the wrong version of protobuf
首先你要卸载,并重装其要求的protobuf版本(2.6.1),之后重新编译就好了


卸载办法:

#removesudo apt-get remove libprotobuf-dev protobuf-compilersudo apt-get remove libprotobuf-lite8 libprotoc8sudo apt-get remove python-protobufsudo pip uninstall protobuf#如果安装了anacondaconda uninstall protobuf

如果出现错误:

E:Encountered a section with no Package: header,

输入以下命令:

sudo rm /var/lib/apt/lists/* -vfsudo apt-get update


重新安装
#reinstallsudo apt-get install libprotobuf-dev protobuf-compiler#if anacondaconda install -c anaconda protobuf=2.6.1或者/home/username/anaconda2/bin/pip install protobuf == 2.6.1


附注:

查看当前protoc版本:protoc --version

查看protoc安装位置:which protoc

查找protoc相关文件:sudo find / -name protoc


手动安装protobuf 2.6.1方法:

http://www.cnblogs.com/javaee6/p/4849051.html



阅读全文
2 0