找不到Pyomo Util模块 [英] Pyomo Util Module Not Found

查看:162
本文介绍了找不到Pyomo Util模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我问了一个问题前.对于这个问题,我有一个非常好的答案.我想测试一下答案现在是否有效.但是我得到了ModuleNotFoundError.

So I asked a question a month ago. I had a really nice answer to that question. I wanted to test if the answer works right now. But I am getting ModuleNotFoundError.

我在测试之前做了以下事情:

I did following before testing:

conda install -c conda-forge pyomo
conda install -c conda-forge pyomo.extras 

我想在我的代码中运行此脚本(从另一个问题中复制/粘贴):

I want to run this script in my code (copy/pasted from the other question):

from pyomo.util.infeasible import log_infeasible_constraints
...
SolverFactory('your_solver').solve(model)
...
log_infeasible_constraints(model)

我遇到的错误:

N:\urbs>python runme.py
Traceback (most recent call last):
  File "runme.py", line 9, in <module>
    from pyomo.util.infeasible import log_infeasible_constraints
ModuleNotFoundError: No module named 'pyomo.util.infeasible'

那如何安装呢?我检查了文档等...,找不到方法.

How to install it then? I checked doc etc..., could not find a way.

推荐答案

Pyomo 5.5(截至2018年8月23日的最新发行版本)尚未具有该功能.我错误地认为它已包括在内.您可以更改pyomo的版本以跟踪master,或者更容易地,只需在

Pyomo 5.5 (the latest released version as of 23 August 2018) does not yet have that feature. I had mistakenly assumed that it was included. You can either change your version of pyomo to track master, or more easily, you can simply take the function at https://github.com/Pyomo/pyomo/blob/master/pyomo/util/infeasible.py and place it in your own code (along with the associated required imports).

这篇关于找不到Pyomo Util模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆