Julia出现错误ERROR: LoadError: syntax: try without catch or finally
Posted czx1
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Julia出现错误ERROR: LoadError: syntax: try without catch or finally相关的知识,希望对你有一定的参考价值。
因项目要求进行机器学习数据可视化,要求尝试使用Julia,在此,记录下遇到的坑,仅为记录效果。后续陆续更新。
问题一:关于Lightml库中的坑:ERROR: LoadError: syntax: try without catch or finally
问题描述:
ENV["PYTHON"]="" Pkg.add("Conda") using Conda Conda.add("python==2.7.13") Conda.add("matplotlib") Conda.add("scikit-learn") Pkg.add("PyCall") Pkg.build("PyCall")
Pkg.clone("https://github.com/memoiry/LightML.jl")
当使用using LightML时出现问题:ERROR: LoadError: syntax: try without catch or finally
[ Info: Precompiling LightML [21c72615-c80e-5f28-8897-21b7f06a9402] ERROR: LoadError: syntax: try without catch or finally Stacktrace: [1] include at .oot.jl:317 [inlined] [2] include_relative(::Module, ::String) at .loading.jl:1038 [3] include(::Module, ::String) at .sysimg.jl:29 [4] top-level scope at none:2 [5] eval at .oot.jl:319 [inlined] [6] eval(::Expr) at .client.jl:389 [7] top-level scope at . one:3 in expression starting at C:Usersadmin.juliapackagesGadflyojGNosrcGadfly.jl:971 ERROR: LoadError: Failed to precompile Gadfly [c91e804a-d5a3-530f-b6f0-dfbca275c004] to C:Usersadmin.juliacompiledv1.0GadflyDvECm.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:1184 [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 .oot.jl:317 [inlined] [9] include_relative(::Module, ::String) at .loading.jl:1038 [10] include(::Module, ::String) at .sysimg.jl:29 [11] top-level scope at none:2 [12] eval at .oot.jl:319 [inlined] [13] eval(::Expr) at .client.jl:389 [14] top-level scope at . one:3 in expression starting at C:Usersadmin.juliadevLightMLsrcLightML.jl:4 ERROR: Failed to precompile LightML [21c72615-c80e-5f28-8897-21b7f06a9402] to C:Usersadmin.juliacompiledv1.0LightMLhSDel.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:1184 [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
问题分析:
很明显这是由于try...catch../finally的问题
问题解决:
定位到文件Gadfly.jl,在980行处加上catch即可,此类问题都可以这样处理。
以上是关于Julia出现错误ERROR: LoadError: syntax: try without catch or finally的主要内容,如果未能解决你的问题,请参考以下文章
Julia LoadError: UndefVarError: plot not defined 问题解决
Julia LoadError: UndefVarError: plot not defined 问题解决
Julia LoadError: UndefVarError: plot not defined 问题解决
LoadError: 无法加载此类文件 -- test/unit/error