问题
I have a .jl file at /Users/myuser/Documents/JuliaLearn/Julia/mysource.jl
In Julia Repl, I'm trying to run as:
include("/Users/myuser/Documents/JuliaLearn/Julia/mysource.jl")
But get this error:
ERROR: could not open file /Users/myuser/~/Documents/JuliaLearn/Julia/mysource.jl in include at /Applications/Julia-0.4.5.app/Contents/Resources/julia/lib/julia/sys.dylib in include_from_node1 at /Applications/Julia-0.4.5.app/Contents/Resources/julia/lib/julia/sys.dylib
I also tried but get an error similar to the above:
include("~/Documents/JuliaLearn/Julia/mysource.jl")
Any idea what I'm doing wrong?
回答1:
Isomorphic to OS:
cd(joinpath(homedir(),"a_long","path","to_your","files"));
include("your_julia_file.jl")
来源:https://stackoverflow.com/questions/37117020/what-should-path-be-to-julia-source-file