环境:
  Ubuntu16.04
  Gurobi8.1

step1.
  去官网下载gurobi,网址:http://www.gurobi.com/downloads/gurobi-optimizer
step2:
  解压下载的文件,命令如下:

tar xvfz gurobi8.1.0_linux64.tar.gz

step3:
  设置环境变量,在~/.bashrc中添加以下部分,注意这部分"/home/hadoop/Downloads/"修改成自己的目录

export GUROBI_HOME=/home/hadoop/Downloads/gurobi810/linux64
export PATH=${PATH}:${GUROBI_HOME}/bin
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${GUROBI_HOME}/lib

step4:
  在官网获取授权的key(学生可以免费得到),网址:https://user.gurobi.com/download/licenses/free-academic
step5:
  进入解压好的gurobi文件夹下,通过step3得到的key进行激活

./gurobi810/linux64/bin/grbgetkey xxxxxxx   //注意文件目录,grbgetkey xxxxxxx则是通过step3得到的

step6:
使环境变量生效,运行

source ~/.bashrc

step7:
验证是否成功,终端输入

gurobi.sh

出现如下则成功:

Python 2.7.13 (default, Sep  4 2017, 15:40:17) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-18)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Academic license - for non-commercial use only

Gurobi Interactive Shell (linux64), Version 8.1.0
Copyright (c) 2018, Gurobi Optimization, LLC
Type "help()" for help

gurobi>

参考:
官方文档:http://www.gurobi.com/documentation/8.1/quickstart_linux.pdf

Logo

更多推荐