简体   繁体   中英

Installing Pyomo on a Mac with Anaconda installed

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.

Pyomo is a Python package, so the way you use it is by importing it in Python scripts and executing those scripts with the Python interpreter that you installed Pyomo into.

If you want use the pyomo command to solve a model file (rather than creating a Pyomo solver object in your Python script and running it directly) you will have to add the bin location of your Anaconda script to your PATH. I do this on my Mac by adding a line like the following to ~/.bash_profile:

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

This will add the location to the beginning of your PATH, causing the Anaconda Python to be executed by default from your terminal (rather than the default system Python). This is also the location that pip will install Pyomo related executables into (assuming you used the pip installed with Anaconda and not the pip associated with some other Python installation).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM