本文介绍了我怎样才能安装 Pyomo 的“附加功能"?使用点子?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写这篇文章是因为我在使用 pip 安装 Pyomo 时遇到问题Mac OSX 10.14 上的 Python 3.6

I am writing because I am having trouble installing Pyomo using pip on Python 3.6 on Mac OSX 10.14

我正在按照此处的安装说明进行操作.

I'm following the installation instructions here.

我可以成功执行第一个命令:

I can successfully execute the first command:

pip install pyomo

但是当我遇到问题时,我应该运行以下命令来安装其他依赖项:

But when I run into trouble when I'm supposed to run the following command to install additional dependencies:

pyomo install-extras

运行此命令会产生以下错误:

Running this command produces the following error:

Traceback (most recent call last):
  File "/usr/local/bin/pyomo", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/site-packages/pyomo/scripting/pyomo_main.py", line 82, in main
    retval = _options.func(_options)
  File "/usr/local/lib/python3.6/site-packages/pyomo/scripting/driver_help.py", line 46, in install_extras_exec
    pyutilib.subprocess.run(command, tee=True)
  File "/usr/local/lib/python3.6/site-packages/pyutilib/subprocess/processmngr.py", line 690, in run_command
    th.join()
UnboundLocalError: local variable 'th' referenced before assignment

Google 网上论坛上有一篇关于此的帖子 但还没有解决方案.

推荐答案

这是 Pyomo github 上的一个记录问题:https://github.com/Pyomo/pyomo/issues/243

This is a documented issue on the github for Pyomo: https://github.com/Pyomo/pyomo/issues/243

他们似乎没有解决 pyomo extras 的 pip 安装问题.

They don't appear to have solved the pip installation of pyomo extras.

但是,如果您安装了 conda - https://docs.conda.io/en/最新/

However, if you have conda installed - https://docs.conda.io/en/latest/

您应该能够使用以下终端命令:

You should be able to use the terminal commands from:

https://pyomo.readthedocs.io/en/latest/installation.html

在成功安装 conda 后在终端中运行:

run this in terminal after conda has been successfully installed:

conda install -c conda-forge pyomo.extras

我知道这不是 pip,但这至少是一种解决方法,直到 pyomo 修复他们的文档.

I know this isn't pip, but it's at least a workaround until pyomo fixes their documentation.

  • 确认在 python 3.x 和 ubuntu 18.04 上工作

这篇关于我怎样才能安装 Pyomo 的“附加功能"?使用点子?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 00:41