2017-07-12 175 views
4

我试图安装Caffe库,但由于在我的系统中安装了错误的protobuf版本,导致编译问题。协议缓冲区错误版本

In file included from .build_release/src/caffe/proto/caffe.pb.cc:5:0: 
.build_release/src/caffe/proto/caffe.pb.h:17:2: error: #error This file was generated by an older version of protoc which is 
#error This file was generated by an older version of protoc which is 
^
.build_release/src/caffe/proto/caffe.pb.h:18:2: error: #error incompatible with your Protocol Buffer headers. Please 
#error incompatible with your Protocol Buffer headers. Please 
^
.build_release/src/caffe/proto/caffe.pb.h:19:2: error: #error regenerate this file with a newer version of protoc. 
#error regenerate this file with a newer version of protoc. 

我跟很多论坛所提出的方法,我认为,最类似的问题进行了讨论in this post

在caffe.pb.h控制是:

#if 3002000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION 
#error This file was generated by an older version of protoc which is 
#error incompatible with your Protocol Buffer headers. Please 
#error regenerate this file with a newer version of protoc. 
#endif 
在我的系统头

然而(/usr/include/google/protobuf/stubs/common.h):

The current version, represented as a single integer to make comparison 
easier: major * 10^6 + minor * 10^3 + micro 
define GOOGLE_PROTOBUF_VERSION 2005000 

从终端的命令protoc --version返回libprotoc 3.2.0

所以我安装了3.2版本,但系统头文件没有更新。 上一篇文章中的一位用户评论道:“我想通过指定PATH变量中的第一个protobuf,而不必删除protobuf的其他版本(其他的东西取决于旧版本)”。

有人可以一步一步地解释我如何遵循这个? 或者我可以更新系统标题?有许多元素连接到libprotoc,所以我想避免损坏它们。

谢谢

回答

0

我解决了这个在我的电脑上,也许它可以帮助你。我的环境是Ubuntu16.04,我在安装Caffe之前安装了Anaconda(用于python2.7)。它发生了,我用conda来安装libprotobuf-dev,这导致与caffe的'sudo apt-get install libprotobuf-dev'命令冲突,因为'apt-get'和conda安装在我的计算机上,可以通过它找到'locate protobuf',所以我删除了Anaconda的libprotobuf版本,并且没有再次发生问题。

conda uninstall libprotobuf 
conda uninstall protobuf 

当您在安装Caffe之前安装tensorflow时,由于libprotobuf冲突,也会发生此问题。