The Gurobi Python Interface for Python Users


The Gurobi Python Interface for Python Users

While the Gurobi installation includes everything you need to use Gurobi from within Python, we understand that some users would prefer to use Gurobi from within their own Python environment. Doing so requires you to install the gurobipy module. The steps for doing this depend on your platform. On Windows, you can double-click on the pysetup program in the Gurobi <installdir>/bin directory. This program will prompt you for the location of your Python installation; it handles all of the details of the installation. On Linux or Mac OS, you will need to open a terminal window, change your current directory to the Gurobi <installdir> (the directory that contains the file setup.py), and issue the following command:

  python setup.py install
Unless you are using your own private Python installation, you will need to run this command as super-user. Once gurobipy is successfully installed, you can type import gurobipy or from gurobipy import * from your Python shell and access all of the Gurobi classes and methods.

Note that for this installation to succeed, your Python environment must be compatible with the Gurobi Python module. You should only install 32-bit Gurobi libraries into a 32-bit Python shell (similarly for 64-bit versions). In addition, your Python version must be compatible. With this release, gurobipy can be used with Python 2.7, 3.4, or 3.5 on Windows and Linux, and with Python 2.7 on Mac OS.