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

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

CXX .build_release/src/caffe/proto/caffe.pb.cc
CXX src/caffe/blob.cpp
CXX src/caffe/data_transformer.cpp
CXX src/caffe/net.cpp
CXX src/caffe/solver.cpp
CXX src/caffe/util/insert_splits.cpp
CXX src/caffe/util/db.cpp
CXX src/caffe/util/upgrade_proto.cpp
In 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),之后重新编译就好了


卸载办法:

#remove
sudo apt-get remove libprotobuf-dev protobuf-compiler
sudo apt-get remove libprotobuf-lite8 libprotoc8
sudo apt-get remove python-protobuf
sudo pip uninstall protobuf
#如果安装了anaconda
conda uninstall protobuf

如果出现错误:

E:Encountered a section with no Package: header,

输入以下命令:

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


重新安装
#reinstall
sudo apt-get install libprotobuf-dev protobuf-compiler
#if anaconda
conda 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



评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值