AttributeError: 'module' object has no attribute 'DefaultRoutingSearchParameters'

AttributeError: 'module' object has no attribute 'DefaultRoutingSearchParameters'

我已经完全按照 this link 中提到的安装了 ortools。

之后,我从文档中复制了车辆路径问题,并尝试execute.I 在我的系统中使用 python 2.7.12。

我遇到了以下错误:

   >>python or_test.py 
      Traceback (most recent call last):
      File "or_test.py", line 120, in <module>
      main()
      File "or_test.py", line 52, in main
     search_parameters = pywrapcp.DefaultRoutingSearchParameters()
   AttributeError: 'module' object has no attribute 
  'DefaultRoutingSearchParameters'

示例问题link: https://developers.google.com/optimization/routing/tsp/vehicle_routing

基于example from the repo,您可以获得这样的默认参数:

 search_parameters = pywrapcp.RoutingModel.DefaultSearchParameters()