您可以通过三种不同的方式安装用于Python的Gurobi Optimizer:
- 从Gurobi 9.1开始,您可以使用pip将Gurobi安装到当前活动的Python环境中:
python-mpip安装-ihttps://pypi.gurobi.com 古罗比
Pip是安装Python包的标准方法,应该可以在大多数平台和系统上使用。
注:pip安装方法不提供Gurobi许可证工具。如果尚未在计算机上设置许可证,则需要使用其他安装方法之一。 - 如果您正在使用蟒蛇,您可以通过Gurobi的conda频道安装Gurobi:
康达安装-c古罗比古罗比
- 安装完整的Gurobi优化器包。
- 下载从我们的网站和安装Gurobi.
- 在shell/终端中,导航到Gurobi安装文件夹(Gurobi_HOME)并运行:
python setup.py安装
笔记:如果您正在使用虚拟环境,请确保在安装Gurobi之前激活虚拟环境。
此表显示了安装方法之间的特点和差异:
皮普 | 康达 | 完整安装程序 | |
不需要Windows管理员权限 | ✅ | ✅ | ❌ |
可以使用Python以外的API | ❌ | ❌ | ✅ |
轻松设置Docker | ✅ | ✅ | ❌ |
Grubi许可证工具(grbgetkey、grbprobe) | ❌ | ✅ | ✅ |
Gurobi shell(Gurobi.sh或Gurobi.bat) | ❌ | ❌ | ✅ |
Gurobi命令行工具(Gurobi_cl、grbcluster、grbtune、grb_ts) | ❌ | ✅ | ✅ |
离线安装 | ❌ | ❌ | ✅ |