3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

GurobipyをMacで自分のPython環境から実行する

Posted at

はじめに

gurobiはターミナルから実行できるほか
Pythonのソースコードからgurobipyライブラリを呼び出して,Pythonでオーバーラップして使用することができます.

import gurobipy as gp

しかし,

pip install gurobipy

だとどうやらエラーが出るらしく,マシンにインストールされたgurobiから直接setup.pyを実行してインストールする必要があるようです.

Macの場合

自分の今のプロジェクトファイルを仮に

~/develop/ProjectAとしてこのProjectAでは,venvなどで仮想のPython環境が実行されているとします.

次にmacのGurobiがインストールされているフォルダに移動します.
これはどうやら

/Library/gurobi0902/mac64のようにLibrary以下にバージョン0902のインデックスがついてそのmac64フォルダに入っているようです.

よって,

cd /Library/gurobi902/mac64/
python setup.py install  

とすればよいです.

これでvenvやvirtualenvにおいて,自分のプロジェクトProjectAなどにライブラリgurobipyを作成することができます.

3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?