Mac OS build caffe2 Error:This file was generated by an older version of protoc which is

问题所在

我们可以发现这个错误跟protobuf的版本有关,因此我们可以执行script/diagnose_protobuf.py

我们可以看到,pip install protobuf 和 brew install protobuf 的版本不一样导致的

解决办法

  1. 更新brew的版本 brew install protobuf@3.4 直接指定版本3.4,根据你的需求作相应的改变
  2. brew link --force --overwrite protobuf@3.4 链接到3.4,因为你的机器上可能装了多个版本
  3. protoc --version
  4. 如果两个版本一样的花,再次执行script/diagnose_protobuf.py 输出:All looks good.