编程语言
首页 > 编程语言> > python-AttributeError:“模块”对象没有属性“ DefaultRoutingSearchParameters”

python-AttributeError:“模块”对象没有属性“ DefaultRoutingSearchParameters”

作者:互联网

我已经完全按照this链接中所述安装了ortools.

之后,我从文档中复制了车辆路线问题并尝试执行.我在系统中使用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'

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

解决方法:

基于example from the repo,您可以改为使用以下默认参数:

 search_parameters = pywrapcp.RoutingModel.DefaultSearchParameters()

标签:pulp,or-tools,python
来源: https://codeday.me/bug/20191025/1929125.html