【发布时间】:2019-04-11 12:15:06
【问题描述】:
我使用pip install ortools 在我的 Mac 上安装了 OR Tools。现在我尝试在https://developers.google.com/optimization/routing/vrp#solution 上运行谷歌给出的示例代码。
在导入 from ortools.constraint_solver import pywrapcp 时,程序崩溃并显示以下消息:
[libprotobuf FATAL google/protobuf/stubs/common.cc:86] 该程序是针对 Protocol Buffer 运行时库的 3.5.1 版本编译的,该版本与已安装的版本 (3.7.1) 不兼容。联系程序作者获取更新。如果您自己编译程序,请确保您的标头来自与链接时库相同版本的 Protocol Buffers。 (“ortools/gen/ortools/data/rcpsp.pb.cc”中的版本验证失败。) libc++abi.dylib:以 google::protobuf::FatalException 类型的未捕获异常终止:该程序是针对 Protocol Buffer 运行时库的 3.5.1 版本编译的,该版本与已安装的版本 (3.7.1) 不兼容.联系程序作者获取更新。如果您自己编译程序,请确保您的标头来自与链接时库相同版本的 Protocol Buffers。 (“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 installation protocol-buffers or-tools