gpt4 book ai didi

c++ - Protocol Buffer 错误版本

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:47:07 24 4
gpt4 key购买 nike

我正在尝试安装 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

但是在我的系统 header (/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 版本,但系统 header 没有更新。上一篇文章中的一位用户评论说“我找到了一种方法,首先在 PATH 变量中指定我想要的 protobuf,而不必删除其他版本的 protobuf(其他事情取决于那个旧版本)。”

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

谢谢

最佳答案

我在我的电脑上解决了这个问题,也许它能帮到你。我的环境是Ubuntu16.04,在安装Caffe之前先安装了Anaconda(for 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冲突。

关于c++ - Protocol Buffer 错误版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45052943/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com