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 or 3.2 on Windows and Linux, and with Python 2.7 on Mac OS.

Try Gurobi for Free

Choose the evaluation license that fits you best, and start working with our Expert Team for technical guidance and support.

Evaluation License
Get a free, full-featured license of the Gurobi Optimizer to experience the performance, support, benchmarking and tuning services we provide as part of our product offering.
Academic License
Gurobi supports the teaching and use of optimization within academic institutions. We offer free, full-featured copies of Gurobi for use in class, and for research.
Cloud Trial

Request free trial hours, so you can see how quickly and easily a model can be solved on the cloud.

Search