或针对 Protocol Buffer 版本 3.5.1 编译的工具,与已安装的版本不兼容

OR Tools compiled against version 3.5.1 of the Protocol Buffer, not compatible with installed version

我用 pip install ortools 在 mac 上安装了 OR 工具。现在我尝试 运行 Google 在 https://developers.google.com/optimization/routing/vrp#solution 上给出的示例代码。

在导入 from ortools.constraint_solver import pywrapcp 时程序崩溃并显示以下消息:

[libprotobuf FATAL google/protobuf/stubs/common.cc:86] This program was compiled against version 3.5.1 of the Protocol Buffer runtime library, which is not compatible with the installed version (3.7.1). Contact the program author for an update. 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 "ortools/gen/ortools/data/rcpsp.pb.cc".) libc++abi.dylib: terminating with uncaught exception of type google::protobuf::FatalException: This program was compiled against version 3.5.1 of the Protocol Buffer runtime library, which is not compatible with the installed version (3.7.1). Contact the program author for an update. 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 "ortools/gen/ortools/data/rcpsp.pb.cc".)

我删除了protobuf的3.7.1版本,并借助pip安装了3.5.1:

Name: protobuf
Version: 3.5.1
Summary: Protocol Buffers
Home-page: https://developers.google.com/protocol-buffers/
Author: protobuf@googlegroups.com
Author-email: protobuf@googlegroups.com
License: 3-Clause BSD License
Location: /Users/Martijn/anaconda/lib/python3.5/site-packages
Requires: setuptools, six

但我仍然收到相同的错误消息。有人遇到过这个问题吗?

或工具:

Name: ortools
Version: 6.7.4973
Summary: Google OR-Tools python libraries and modules
Home-page: https://developers.google.com/optimization/
Author: Google Inc
Author-email: lperron@google.com
License: Apache 2.0
Location: /Users/Martijn/anaconda/lib/python3.5/site-packages
Requires: six, protobuf

出于某种原因,我无法使用 pip 升级到更新版本的 OR 工具。

你能升级到 python 3.6 吗? 最新版本 (7.0) 在 mac.

上支持 2.7、3.7 和 3.7

请注意,它们是使用 3.6.1 构建的。 下一版本将包括 3.7.1.