首页 > 解决方案 > 添加包时如何使用 Julia 规避预编译错误

问题描述

我正在尝试在 Julia 编程中使用三个不同的包(使用 Atom IDE,值得一提)。

我对朱莉娅很陌生,所以请原谅任何无知!这是我所拥有的:

Pkg.add("JuMP")
Pkg.add("DataFrames")
Pkg.add("GLPKMathProgInterface")

这些运行成功。

然后我有:

using DataFrames
using GLPKMathProgInterface
using JuMP

“使用 DataFrames”行成功执行,但之后我收到预编译/安装错误:

ERROR: LoadError: GLPK not properly installed. Please run Pkg.build("GLPK")
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] top-level scope at /Users/connordaly/.julia/packages/GLPK/thMVo/src/GLPK.jl:199
 [3] include at ./boot.jl:317 [inlined]
 [4] include_relative(::Module, ::String) at ./loading.jl:1038
 [5] include(::Module, ::String) at ./sysimg.jl:29
 [6] top-level scope at none:2
 [7] eval at ./boot.jl:319 [inlined]
 [8] eval(::Expr) at ./client.jl:399
 [9] top-level scope at ./none:3
in expression starting at /Users/connordaly/.julia/packages/GLPK/thMVo/src/GLPK.jl:196
ERROR: LoadError: LoadError: Failed to precompile GLPK [60bf3e95-4087-53dc-ae20-288a0d20c6a6] to /Users/connordaly/.julia/compiled/v0.7/GLPK/r6CoY.ji.
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] macro expansion at ./logging.jl:313 [inlined]
 [3] compilecache(::Base.PkgId, ::String) at ./loading.jl:1185
 [4] _require(::Base.PkgId) at ./logging.jl:311
 [5] require(::Base.PkgId) at ./loading.jl:852
 [6] macro expansion at ./logging.jl:311 [inlined]
 [7] require(::Module, ::Symbol) at ./loading.jl:834
 [8] include at ./boot.jl:317 [inlined]
 [9] include_relative(::Module, ::String) at ./loading.jl:1038
 [10] include at ./sysimg.jl:29 [inlined]
 [11] include(::String) at /Users/connordaly/.julia/packages/GLPKMathProgInterface/Ijibf/src/GLPKMathProgInterface.jl:2
 [12] top-level scope at none:0
 [13] include at ./boot.jl:317 [inlined]
 [14] include_relative(::Module, ::String) at ./loading.jl:1038
 [15] include(::Module, ::String) at ./sysimg.jl:29
 [16] top-level scope at none:2
 [17] eval at ./boot.jl:319 [inlined]
 [18] eval(::Expr) at ./client.jl:399
 [19] top-level scope at ./none:3
in expression starting at /Users/connordaly/.julia/packages/GLPKMathProgInterface/Ijibf/src/GLPKInterfaceBase.jl:6
in expression starting at /Users/connordaly/.julia/packages/GLPKMathProgInterface/Ijibf/src/GLPKMathProgInterface.jl:10
ERROR: Failed to precompile GLPKMathProgInterface [3c7084bd-78ad-589a-b5bb-dbd673274bea] to /Users/connordaly/.julia/compiled/v0.7/GLPKMathProgInterface/Y5bTM.ji.
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] macro expansion at ./logging.jl:313 [inlined]
 [3] compilecache(::Base.PkgId, ::String) at ./loading.jl:1185
 [4] macro expansion at ./logging.jl:311 [inlined]
 [5] _require(::Base.PkgId) at ./loading.jl:941
 [6] require(::Base.PkgId) at ./loading.jl:852
 [7] macro expansion at ./logging.jl:311 [inlined]
 [8] require(::Module, ::Symbol) at ./loading.jl:834

我已经尝试了很多方法来让这个包工作,但到目前为止还没有运气。谁能帮帮我?提前致谢!

标签: juliajulia-jump

解决方案


作为 Julia 的新用户,我假设您正在尝试这个 1.0 版本。该公告与https://discourse.julialang.org/t/psa-use-julia-0-7-if-you-are-upgrading/13321相关。

Julia 0.7 具有与 1.0 相同的功能,但仍具有兼容性的弃用警告,这些警告已在 1.0 中删除。

暂时试试 Julia 0.7。Pkg.build("GLPK")如果您再次遇到该特定错误,您可能还添加了。


推荐阅读