首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用Gurobi?

如何使用Gurobi?
EN

Stack Overflow用户
提问于 2020-12-10 14:42:49
回答 1查看 324关注 0票数 0

我想在这样的程序中使用Gurobi:

代码语言:javascript
复制
use Gurobi

它会收到以下错误消息:

代码语言:javascript
复制
ERROR: LoadError:     Gurobi not properly installed. Please run Pkg.build("Gurobi"). For
    more information go to https://github.com/jump-dev/Gurobi.jl

Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] top-level scope at /Users/prikshetsharma/.julia/packages/Gurobi/P6eVP/src/Gurobi.jl:7
 [3] include(::Function, ::Module, ::String) at ./Base.jl:380
 [4] include(::Module, ::String) at ./Base.jl:368
 [5] top-level scope at none:2
 [6] eval at ./boot.jl:331 [inlined]
 [7] eval(::Expr) at ./client.jl:467
 [8] top-level scope at ./none:3
in expression starting at /Users/prikshetsharma/.julia/packages/Gurobi/P6eVP/src/Gurobi.jl:4
ERROR: LoadError: Failed to precompile Gurobi [2e9cd046-0924-5485-92f1-d5272153d98b] to /Users/prikshetsharma/.julia/compiled/v1.5/Gurobi/do9v6_rMyJO.ji.
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1305
 [3] _require(::Base.PkgId) at ./loading.jl:1030
 [4] require(::Base.PkgId) at ./loading.jl:928
 [5] require(::Module, ::Symbol) at ./loading.jl:923
 [6] include(::Function, ::Module, ::String) at ./Base.jl:380
 [7] include(::Module, ::String) at ./Base.jl:368
 [8] exec_options(::Base.JLOptions) at ./client.jl:296
 [9] _start() at ./client.jl:506
in expression starting at /Users/prikshetsharma/Documents/clotorch/src/clotorch/flight/opt.jl:

当安装Gurobi本身时,我得到了以下错误,提到了一个安装问题和修复它的步骤:

代码语言:javascript
复制
Pkg.build("Gurobi")
   Building Gurobi → `~/.julia/packages/Gurobi/P6eVP/deps/build.log`
┌ Error: Error building `Gurobi`: 
│ ERROR: LoadError: Unable to locate Gurobi installation. If the advice above did not help,
│ open an issue at https://github.com/jump-dev/Gurobi.jl and post the full
│ print-out of this diagnostic attempt.
│ 
│ Stacktrace:
│  [1] error(::String) at ./error.jl:33
│  [2] top-level scope at /Users/prikshetsharma/.julia/packages/Gurobi/P6eVP/deps/build.jl:161
│  [3] include(::String) at ./client.jl:457
│  [4] top-level scope at none:5
│ in expression starting at /Users/prikshetsharma/.julia/packages/Gurobi/P6eVP/deps/build.jl:155
│ 
│ **Unable to locate Gurobi installation. Running some common diagnostics.**
│ 
│ Gurobi.jl only supports the following versions:
│ 
│  - gurobi90
│  - gurobi91
│ 
│ Did you download and install one of these versions from gurobi.com?
│ Installing Gurobi.jl via the Julia package manager is _not_ sufficient!
│ 
│ Found GUROBI_HOME =  /Library/gurobi910/mac64/
│ 
│ Does this point to the correct install location?
│ 
│ We're going to look for the Gurobi library in this directory:
│     /Library/gurobi910/mac64/lib
│ 
│ That directory has the following files:
│ 
│ Aha! We tried looking in `/Library/gurobi910/mac64/lib`, but something went wrong. Are
│ you sure that your GUROBI_HOME environment variable is correct?
│ When combined with the appropriate suffix (e.g., `lib` or
│ `bin`, it needs to point to a valid directory.
│ 
│ 
│ You should set the `GUROBI_HOME` environment variable to point to the
│ install location then try again. For example (updating the path to the
│ correct location if needed):
│ ```
│ # On Windows, this might be
│ ENV["GUROBI_HOME"] = "C:\\Program Files\\gurobi910\\win64\\"
│ import Pkg
│ Pkg.add("Gurobi"
│ Pkg.build("Gurobi")
│ 
│ # On OSX, this might be
│ ENV["GUROBI_HOME"] = "/Library/gurobi910/mac64/"
│ import Pkg
│ Pkg.add("Gurobi")
│ Pkg.build("Gurobi")
│ 
│ # On Unix, this might be
│ ENV["GUROBI_HOME"] = "/opt/gurobi910/linux64/"
│ import Pkg
│ Pkg.add("Gurobi")
│ Pkg.build("Gurobi")
│ ```
│ **Note: your path may differ. Check which folder you installed the Gurobi
│ binary in, and update the path accordingly.**
└ @ Pkg.Operations /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Pkg/src/Operations.jl:949

我已经按照上述跟踪中提到的macOS步骤进行了操作,但仍然收到上述错误。如何安装Gurobi并成功使用?

EN

回答 1

Stack Overflow用户

发布于 2021-03-07 04:11:40

您需要先安装独立的Gurobi包。请关注instructions in these guides了解更多信息。正如评论中已经提到的,您还应该获得运行Gurobi的许可证。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65229646

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档