caffe安装错误(补充)protobuf

之前在https://blog.csdn.net/uniqueyyc/article/details/83338889,这个里面已经列出错误并解决了。但是过了些天,想要重新编译时发现又会出错,我猜想可能的原因是在更新系统软件时也更新了protobuf,好像知道原因,但还是很难去解决,现在终于解决了就记录下来,免得下次再次碰到。

之前还有个错误是C++编译版本,我在cmakelists文件中加入了以下代码,也不知道有没有起作用:

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

而且重新编译了一下opencv3.4,加入了以下的部分重新编译了

以上操作后,错误提示:

CXX .build_release/src/caffe/proto/caffe.pb.cc
In file included from .build_release/src/caffe/proto/caffe.pb.cc:4: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.
  ^
In file included from .build_release/src/caffe/proto/caffe.pb.cc:4:0:
.build_release/src/caffe/proto/caffe.pb.h:23:35: fatal error: google/protobuf/arena.h: 没有那个文件或目录
compilation terminated.
Makefile:598: recipe for target '.build_release/src/caffe/proto/caffe.pb.o' failed
make: *** [.build_release/src/caffe/proto/caffe.pb.o] Error 1

解决方案:

思想:

可能问题一:安装了anaconda,在anaconda里面重复安装了protobuf,所以导致冲突,也就是重复执行了

sudo apt-get install libprotobuf-dev
和
conda install libprotobuf

可能问题二:protobuf版本太高,与要求不符合,我之前的是3.6.0

// 查看protobuf版本命令
protoc --version

解决:

//如果安装2.6.1版本

# 移除所有相关protobuf的版本
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
conda uninstall libprotobuf

# 重新安装
sudo apt-get install libprotobuf-dev protobuf-compiler
#if anaconda,不要重复
conda install -c anaconda protobuf=2.6.1

安装3.5.1版本

https://github.com/protocolbuffers/protobuf/releases

在上述网站上找到源码并下载,然后编译

安装具体步骤参照下述网址:https://blog.csdn.net/Changer_sun/article/details/79264326

 

然后重新编译caffe, make all就没有问题了。还有其他问题参考之前的博客https://blog.csdn.net/uniqueyyc/article/details/83338889

参考地址:https://blog.csdn.net/u013498583/article/details/74231058

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Caffe是一个深度学习框架,它依赖于protobufProtocol Buffers)。目前,Caffe可以使用protobuf 3.6.0来编译。因此,如果你想将Caffe与TensorFlow一起使用,你需要调整依赖项版本,确保使用的是protobuf-3.6.0版本来编译Caffe。 关于protobuf的版本,你提到了一个问题与相关的引用内容。你提到Caffe装了3.3.0版本,但你需要的是3.6.0版本。你通过pip的list命令查看了已安装的包,发现安装protobuf 3.6.0。为了满足你的需求,你打算卸载protobuf 3.6.0。 综上所述,Caffeprotobuf的版本相关。Caffe可以使用protobuf 3.6.0来编译,并且你可以通过卸载安装了的protobuf 3.6.***<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* [Caffe,protobuf 编译安装](https://blog.csdn.net/Tosonw/article/details/91043145)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *3* [【深度学习】Caffe中的Protobuf版本问题](https://blog.csdn.net/phdsky/article/details/80994090)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值