---
# System prepended metadata

title: '**How to install gurobi python and get academic licence (Windows)**'

---

# **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.

![](https://i.imgur.com/L1gFYH3.png)



### `Chose the corresponding version`

![](https://i.imgur.com/wIU2u9h.png)

![](https://i.imgur.com/oO1UP8w.png)

### 2. Access the licence (Academy)

Use the academic License: 

![](https://i.imgur.com/iXjhfAJ.png)

![](https://i.imgur.com/eM3NRlk.png)

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

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

![](https://i.imgur.com/XmnJTiD.png)


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


![](https://i.imgur.com/vlVUcpE.png)
Windows —> Setting —> About —>Advance system setting —> Environment variable


![](https://i.imgur.com/fqUfsIw.png)
System Variable —> add a system variable with name "GRB_LICENSE_FILE" and value "C:\Users\USER\y\gurobi.lic" (your file path).

![](https://i.imgur.com/55sybec.png)
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`**

![](https://i.imgur.com/Kx5SlTs.png)
![](https://i.imgur.com/QKT06L0.png)


Input the command : 

```basic

python setup.py install

```

---

## `Test in python`

```python
from gurobipy import *
```

---

## `Reference`

[如何在python中安装Gurobi（详细教程）_Book-bei的博客-CSDN博客_gurobi python](https://blog.csdn.net/weixin_41596280/article/details/89112302)

[Python - gurobi](https://www.gurobi.com/documentation/9.1/quickstart_mac/cs_python.html)


[The optimization model](https://www.gurobi.com/documentation/9.1/quickstart_mac/the_optimization_model.html)

[Simple Python Example](https://www.gurobi.com/documentation/9.1/quickstart_mac/cs_simple_python_example.html)

[My notion version](https://irradiated-drizzle-6f2.notion.site/How-to-install-gurobi-python-and-get-academic-licence-Windows-c69b9495af664dc4ae8f7dffdfaca163)

