我正在测试基于 protobuf 3.0.0-b3/30.0-b2 的 tensorflow。但当前的 Ubuntu 16.04 存储库附带 protobuf 2.6.1 ... 因此,当我测试我的 tensorflow 代码时,我遇到了此错误消息:
[libprotobuf FATAL google/protobuf/stubs/common.cc:61] This program requires version 3.0.0 of the Protocol Buffer runtime library, but the installed version is 2.6.1. Please update your library. If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library. (Version verification failed in "external/protobuf/src/google/protobuf/any.pb.cc".)
terminate called after throwing an instance of 'google::protobuf::FatalException'
what(): This program requires version 3.0.0 of the Protocol Buffer runtime library, but the installed version is 2.6.1. Please update your library. If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library. (Version verification failed in "external/protobuf/src/google/protobuf/any.pb.cc".)
Aborted (core dumped)
我想知道如何解决这个protobuf版本冲突问题。
答案1
不幸的是,protobuf3无法通过apt-get获取直到 Ubuntu 16.10(Yakkety Yak)。因此,您要么需要先更新到该版本的 Ubuntu,要么从其 git 存储库获取该库。
按照以下说明操作https://github.com/google/protobuf/blob/master/src/README.md,或者从这里安装预构建的https://github.com/google/protobuf/releases或者自己从源代码构建(如果您可能想加入库本身的开发工作)。
答案2
我不确定这是否是你要找的。我发现了一个非常简单的方法将 protobuf 从 2.6.1 升级到 3.5.2。post1对于 Python 2.7
sudo pip install --upgrade protobuf
例如:
答案3
由于 bionic beaver protobuf 版本 3 可以直接通过 apt 获得。
https://launchpad.net/ubuntu/+source/protobuf
$ sudo apt install protobuf-compiler
...
$ protoc --version
libprotoc 3.0.0