当我尝试在 Julia 命令提示符下编译我的 Julia 文件时,如下所示:
julia> include("file.jl")
它向我显示了这个错误,我无法理解:
[ Info: Precompiling PyPlot [d330b81b-6aea-500a-939a-2ce795aea3ee]
ERROR: LoadError: LoadError: could not load library "/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0"
/usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0: wrong ELF class: ELFCLASS64
Stacktrace:
[1] dlopen(::String, ::UInt32) at /buildworker/worker/package_linux32/build/usr/share/julia/stdlib/v1.0/Libdl/src/Libdl.jl:97
[2] top-level scope at /home/toto/.julia/packages/PyCall/zqDXB/src/startup.jl:47 [inlined]
[3] top-level scope at ./none:0
[4] include at ./boot.jl:317 [inlined]
[5] include_relative(::Module, ::String) at ./loading.jl:1044
[6] include at ./sysimg.jl:29 [inlined]
[7] include(::String) at /home/toto/.julia/packages/PyCall/zqDXB/src/PyCall.jl:1
[8] top-level scope at none:0
[9] include at ./boot.jl:317 [inlined]
[10] include_relative(::Module, ::String) at ./loading.jl:1044
[11] include(::Module, ::String) at ./sysimg.jl:29
[12] top-level scope at none:2
[13] eval at ./boot.jl:319 [inlined]
[14] eval(::Expr) at ./client.jl:393
[15] top-level scope at ./none:3
in expression starting at /home/toto/.julia/packages/PyCall/zqDXB/src/startup.jl:41
in expression starting at /home/toto/.julia/packages/PyCall/zqDXB/src/PyCall.jl:34
ERROR: LoadError: Failed to precompile PyCall [438e738f-606a-5dbb-bf0a-cddfbfd45ab0] to /home/toto/.julia/compiled/v1.0/PyCall/GkzkC.ji.
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1203
[3] _require(::Base.PkgId) at ./loading.jl:960
[4] require(::Base.PkgId) at ./loading.jl:858
[5] require(::Module, ::Symbol) at ./loading.jl:853
[6] include at ./boot.jl:317 [inlined]
[7] include_relative(::Module, ::String) at ./loading.jl:1044
[8] include(::Module, ::String) at ./sysimg.jl:29
[9] top-level scope at none:2
[10] eval at ./boot.jl:319 [inlined]
[11] eval(::Expr) at ./client.jl:393
[12] top-level scope at ./none:3
in expression starting at /home/toto/.julia/packages/PyPlot/XHEG0/src/PyPlot.jl:4
ERROR: LoadError: LoadError: LoadError: Failed to precompile PyPlot [d330b81b-6aea-500a-939a-2ce795aea3ee] to /home/toto/.julia/compiled/v1.0/PyPlot/oatAj.ji.
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1203
[3] _require(::Base.PkgId) at ./loading.jl:960
[4] require(::Base.PkgId) at ./loading.jl:858
[5] require(::Module, ::Symbol) at ./loading.jl:853
[6] include at ./boot.jl:317 [inlined]
[7] include_relative(::Module, ::String) at ./loading.jl:1044
[8] include(::Module, ::String) at ./sysimg.jl:29
[9] include(::String) at ./client.jl:392
[10] top-level scope at none:0
[11] include at ./boot.jl:317 [inlined]
[12] include_relative(::Module, ::String) at ./loading.jl:1044
[13] include(::Module, ::String) at ./sysimg.jl:29
[14] include(::String) at ./client.jl:392
[15] top-level scope at none:0
[16] include at ./boot.jl:317 [inlined]
[17] include_relative(::Module, ::String) at ./loading.jl:1044
[18] include(::Module, ::String) at ./sysimg.jl:29
[19] include(::String) at ./client.jl:392
[20] top-level scope at none:0
in expression starting at /home/toto/project/code/julia/file3.jl:1
in expression starting at /home/toto/project/code/julia/file2.jl:2
in expression starting at /home/toto/project/code/julia/file.jl:1
我该如何解决这个问题?我注意到我已经安装了 PyPlot :
julia> import Pkg; Pkg.add("PyPlot")
Resolving package versions...
Updating `~/.julia/environments/v1.0/Project.toml`
[no changes]
Updating `~/.julia/environments/v1.0/Manifest.toml`
[no changes]
我还注意到,我在使用 Juno 的第二个 Julia 命令窗口中遇到了这个错误,因为 Juno 的标准 REPL 正在运行一些其他代码。REPL 中的其他代码也包括我的“错误”文件,file.jl, file2.jl
并且file3.jl
在那里运行得很好。