Try   HackMD

How to install gurobi python and get academic licence (Windows)

Install gurobi & get license

1. Log in with your academy email (https://www.gurobi.com/downloads/) and download Gurobi Optimizer.

Chose the corresponding version

2. Access the licence (Academy)

Use the academic License:

copy your key (in this example is " grbgetkey 53f2fe08-fade-11eb-8a57-0242ac130004 ")

Activate Gurobi

1. Open Your cmd or WSL, and paste your Gurobi licence key

 grbgetkey 53f2fe08-fade-11eb-8a57-0242ac130004

copy the file path "C:\Users\USER\y\gurobi.lic"

If it shows the message "Unable to contact key server", it means failure of activation. You should redo the previous steps.

2. Setting Environment Variable


Windows —> Setting —> About —>Advance system setting —> Environment variable


System Variable —> add a system variable with name "GRB_LICENSE_FILE" and value "C:\Users\USER\y\gurobi.lic" (your file path).


Paste "the file path "C:\Users\USER\y\gurobi.lic" on variable value.

Install Gurobi into python library

  • Open terminal in the file which is installed Gurobi


Input the command :


python setup.py install


Test in python

from gurobipy import *

Reference

如何在python中安装Gurobi(详细教程)_Book-bei的博客-CSDN博客_gurobi python

Python - gurobi

The optimization model

Simple Python Example

My notion version