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.

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Chose the corresponding version

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

2. Access the licence (Academy)

Use the academic License:

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

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

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

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

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

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

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

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

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

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

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

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