0

I am new to Mac, having been well-versed in PCs for over 20 years. Unfortunately, the ease at which I can get "under the hood" with a PC is nigh on impossible for me to intuitively sort out in a Mac (ironic isn't it?). In any case, here is my situation:

I am looking to install a number of open-source analyst-centric tools on my new Mac, to include Python, R, and Pyomo. I am doing some home-testing to explore the viability of these tools for an enterprise solution on a work network. As such, I am looking at Anaconda Navigator as a potential one-stop shop for managing a variety of tools.

I have successfully installed Anaconda 4.3 with a Python 3.6 environment on the Mac, but I am running into trouble installing (or rather finding) Pyomo.

I attempted to do a "conda" install of Pyomo via the terminal shell, but got an error. I then attempted a "pip" install which apparently worked.

Unfortunately, I have no idea how to invoke Pyomo, either from the OS X interface or from Anaconda. This is partially due to my inexperience with the OS X system and how to navigate the file and/or PATH structure.

As I am attempting to evaluate Anaconda, how can I set up Pyomo through the Anaconda Navigator shell? I have attempted importing a new environment, but cannot find a specification file, again due to my inability to navigate the OS X file system.

All installations have been completing using default settings.

4

1 回答 1

0

Pyomo 是一个 Python 包,因此您使用它的方式是将其导入 Python 脚本并使用您安装 Pyomo 的 Python 解释器执行这些脚本。

如果您想使用该pyomo命令求解模型文件(而不是在 Python 脚本中创建 Pyomo 求解器对象并直接运行它),则必须将 Anaconda 脚本的 bin 位置添加到 PATH。我在我的 Mac 上通过在 ~/.bash_profile 中添加如下一行来执行此操作:

export PATH=/Users/gabe/<Anaconda-installation-directory>/bin:$PATH

这会将位置添加到 PATH 的开头,从而默认从终端(而不是默认的系统 Python)执行 Anaconda Python。这也是 pip 将 Pyomo 相关的可执行文件安装到的位置(假设您使用了与 Anaconda 一起安装的 pip,而不是与其他 Python 安装关联的 pip)。

于 2017-02-10T18:02:02.750 回答