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 .\boot.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 .\boot.jl:319 [inlined] [6] eval(::Expr) at .\client.jl:389 [7] top-level scope at .\none:3 in expression starting at C:\Users\admin\.julia\packages\Gadfly\ojGNo\src\Gadfly.jl:971 ERROR: LoadError: Failed to precompile Gadfly [c91e804a-d5a3-530f-b6f0-dfbca275c004] to C:\Users\admin\.julia\compiled\v1.0\Gadfly\DvECm.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 .\boot.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 .\boot.jl:319 [inlined] [13] eval(::Expr) at .\client.jl:389 [14] top-level scope at .\none:3 in expression starting at C:\Users\admin\.julia\dev\LightML\src\LightML.jl:4 ERROR: Failed to precompile LightML [21c72615-c80e-5f28-8897-21b7f06a9402] to C:\Users\admin\.julia\compiled\v1.0\LightML\hSDel.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即可,此类问题都可以这样处理。
太过安逸的日子给人未必是幸福,它很有可能毁了一个人的理想,腐蚀一个人的心灵