问题
在Julia中使用第三方包Plots时,using Plots之后报错:
[ Info: Precompiling Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80]
ERROR: LoadError: InitError: UndefVarError: GR_jll not defined
Stacktrace:
[1] __init__()
@ GR.GRPreferences F:\Julia-1.8.2\packages\packages\GR\mf3ag\src\preferences.jl:50
[2] _include_from_serialized(pkg::Base.PkgId, path::String, depmods::Vector{Any})
@ Base .\loading.jl:831
[3] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String, build_id::UInt64)
@ Base .\loading.jl:1039
[4] _require(pkg::Base.PkgId)
@ Base .\loading.jl:1315
[5] _require_prelocked(uuidkey::Base.PkgId)
@ Base .\loading.jl:1200
[6] macro expansion
@ .\loading.jl:1180 [inlined]
[7] macro expansion
@ .\lock.jl:223 [inlined]
[8] require(into::Module, mod::Symbol)
@ Base .\loading.jl:1144
[9] top-level scope
@ F:\Julia-1.8.2\packages\packages\Plots\tDHxD\src\backends.jl:402
[10] eval
@ .\boot.jl:368 [inlined]
[11] _initialize_backend(pkg::Plots.GRBackend)
@ Plots F:\Julia-1.8.2\packages\packages\Plots\tDHxD\src\backends.jl:401
[12] backend(pkg::Plots.GRBackend)
@ Plots F:\Julia-1.8.2\packages\packages\Plots\tDHxD\src\backends.jl:266
[13] backend(sym::Symbol)
@ Plots F:\Julia-1.8.2\packages\packages\Plots\tDHxD\src\backends.jl:276
[14] load_default_backend()
@ Plots F:\Julia-1.8.2\packages\packages\Plots\tDHxD\src\backends.jl:207
[15] backend()
@ Plots F:\Julia-1.8.2\packages\packages\Plots\tDHxD\src\backends.jl:254
[16] top-level scope
@ F:\Julia-1.8.2\packages\packages\Plots\tDHxD\src\init.jl:83
[17] include(mod::Module, _path::String)
@ Base .\Base.jl:419
[18] include(x::String)
@ Plots F:\Julia-1.8.2\packages\packages\Plots\tDHxD\src\Plots.jl:1
[19] top-level scope
@ F:\Julia-1.8.2\packages\packages\Plots\tDHxD\src\Plots.jl:176
[20] include
@ .\Base.jl:419 [inlined]
[21] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::String)
@ Base .\loading.jl:1554
[22] top-level scope
@ stdin:1
during initialization of module GRPreferences
in expression starting at F:\Julia-1.8.2\packages\packages\Plots\tDHxD\src\init.jl:83
in expression starting at F:\Julia-1.8.2\packages\packages\Plots\tDHxD\src\Plots.jl:1
in expression starting at stdin:1
ERROR: Failed to precompile Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80] to F:\Julia-1.8.2\packages\compiled\v1.8\Plots\jl_1A87.tmp.
Stacktrace:
[1] error(s::String)
@ Base .\error.jl:35
[2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, keep_loaded_modules::Bool)
@ Base .\loading.jl:1707
[3] compilecache
@ .\loading.jl:1651 [inlined]
[4] _require(pkg::Base.PkgId)
@ Base .\loading.jl:1337
[5] _require_prelocked(uuidkey::Base.PkgId)
@ Base .\loading.jl:1200
[6] macro expansion
@ .\loading.jl:1180 [inlined]
[7] macro expansion
@ .\lock.jl:223 [inlined]
[8] require(into::Module, mod::Symbol)
@ Base .\loading.jl:1144
[9] eval
@ .\boot.jl:368 [inlined]
[10] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
@ Base .\loading.jl:1428
[11] invokelatest(::Any, ::Any, ::Vararg{Any}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ Base .\essentials.jl:729
[12] invokelatest(::Any, ::Any, ::Vararg{Any})
@ Base .\essentials.jl:726
[13] inlineeval(m::Module, code::String, code_line::Int64, code_column::Int64, file::String; softscope::Bool)
@ VSCodeServer c:\Users\conce\.vscode\extensions\julialang.language-julia-1.38.2\scripts\packages\VSCodeServer\src\eval.jl:233
[14] (::VSCodeServer.var"#66#70"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})()
@ VSCodeServer c:\Users\conce\.vscode\extensions\julialang.language-julia-1.38.2\scripts\packages\VSCodeServer\src\eval.jl:157
[15] withpath(f::VSCodeServer.var"#66#70"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams}, path::String)
@ VSCodeServer c:\Users\conce\.vscode\extensions\julialang.language-julia-1.38.2\scripts\packages\VSCodeServer\src\repl.jl:249
[16] (::VSCodeServer.var"#65#69"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})()
@ VSCodeServer c:\Users\conce\.vscode\extensions\julialang.language-julia-1.38.2\scripts\packages\VSCodeServer\src\eval.jl:155
[17] hideprompt(f::VSCodeServer.var"#65#69"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})
@ VSCodeServer c:\Users\conce\.vscode\extensions\julialang.language-julia-1.38.2\scripts\packages\VSCodeServer\src\repl.jl:38
[18] (::VSCodeServer.var"#64#68"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})()
@ VSCodeServer c:\Users\conce\.vscode\extensions\julialang.language-julia-1.38.2\scripts\packages\VSCodeServer\src\eval.jl:126
[19] with_logstate(f::Function, logstate::Any)
@ Base.CoreLogging .\logging.jl:511
[20] with_logger
@ .\logging.jl:623 [inlined]
[21] (::VSCodeServer.var"#63#67"{VSCodeServer.ReplRunCodeRequestParams})()
@ VSCodeServer c:\Users\conce\.vscode\extensions\julialang.language-julia-1.38.2\scripts\packages\VSCodeServer\src\eval.jl:225
[22] #invokelatest#2
@ .\essentials.jl:729 [inlined]
[23] invokelatest(::Any)
@ Base .\essentials.jl:726
[24] macro expansion
@ c:\Users\conce\.vscode\extensions\julialang.language-julia-1.38.2\scripts\packages\VSCodeServer\src\eval.jl:34 [inlined]
[25] (::VSCodeServer.var"#61#62")()
@ VSCodeServer .\task.jl:484
尝试过但没能结局问题的方法
rm GR
,rm GR_jll
,rm Plots
,再重新安装这三个包Pkg.update()
请教各位,如何解决这个报错?