【问题标题】:Problem when importing PySCIPOpt. AttributeError: type object 'pyscipopt.scip.Expr' has no attribute '__div__'导入 PySCIPOpt 时出现问题。 AttributeError:类型对象“pyscipopt.scip.Expr”没有属性“__div__”
【发布时间】:2020-06-25 09:26:34
【问题描述】:

我想为SCIP使用python接口;我在these steps 之后安装了PySCIPOpt

我正在使用SCIP7PySCIPOpt 3 和 python 3.7。 SCIP 的交互式 shell 单独运行良好。但是,当我尝试import pyscipopt 时,出现以下错误

文件“src/pyscipopt/scip.pyx”,第 1 行, init pyscipopt.scip AttributeError:类型对象 'pyscipopt.scip.Expr' 没有属性 'div'

我的操作系统是 Linux Mint 19.2

我尝试按照建议测试安装,但图像中出现错误

【问题讨论】:

  • 您是否按照 github 页面上的建议尝试了testing the installation
  • 是的,我在上图中得到以下错误
  • 您好,您解决了吗?我今天遇到同样的问题:(
  • 不,我没有!我将 ZIMPL 与 SCIP 一起使用,而不是 PySCIPOpt;而且我必须说这是非常不实用的......

标签: python interface scip


【解决方案1】:

问题似乎是 cython 的更新。它应该在 PySCIPOpt 的当前 master 中修复。另见https://github.com/SCIP-Interfaces/PySCIPOpt/issues/397

【讨论】:

  • 谢谢!安装新版本的 PySCIPOpt 解决了我的问题。
【解决方案2】:

python 对语法非常敏感,比如大写等等。

你可以试试:

import PySCIPOpt instate import pyscipopt

【讨论】:

  • 语法正确,根据Github页面全部小写;如果我按照你的建议去做,我会得到:ModuleNotFoundError: No module named 'PySCIPOpt'
猜你喜欢
  • 2022-01-23
  • 2019-06-08
  • 1970-01-01
  • 2019-06-09
  • 2022-01-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多