问题描述
我的Julia REPL帮助为LOAD_PATH提供了以下内容:
My Julia REPL Help provides the following for LOAD_PATH:
help?> LOAD_PATH
search: LOAD_PATH
LOAD_PATH
An array of paths for using and import statements to consdier as project environments or package directories when
loading code. See Code Loading.
这是我在提示符下的LOAD_PATH的输出:
Here is my output for LOAD_PATH at the prompt:
julia> LOAD_PATH # What is the output below?
3-element Array{String,1}:
"@"
"@v#.#"
"@stdlib"
上面显示的LOAD_PATH的输出似乎很奇怪.
The output shown above for LOAD_PATH seems strange.
有什么建议吗?
推荐答案
您看到的是 DEFAULT_LOAD_PATH
.
What you see there is the DEFAULT_LOAD_PATH
.
让我引用来自源代码的:
Let me cite comments from the relevant section of the source code:
## LOAD_PATH, HOME_PROJECT & ACTIVE_PROJECT ##
# JULIA_LOAD_PATH: split on `:` (or `;` on Windows)
# first empty entry is replaced with DEFAULT_LOAD_PATH, the rest are skipped
# entries starting with `@` are named environments:
# - the first three `#`s in a named environment are replaced with version numbers
# - `@stdlib` is a special name for the standard library and expands to its path
换句话说,
-
"@"
:用于加载相对于当前路径的内容(此处不能完全确定,请参见下面的更新) -
"@v#.#"
:将成为v1.0
环境的路径(假设您使用的是1.0). -
"@stdlib"
:将成为标准库的路径
"@"
: is for loading things relative to the current path (not completely sure here, see update below)"@v#.#"
: will become the path to thev1.0
environment (assuming you are on 1.0)."@stdlib"
: will become the path to the stdlibs
这可能应该在Pkg文档中的某个地方更准确地解释.介意在那儿解决问题? (更新:请参见 https://github.com/JuliaLang/Pkg.jl/issues/757 )
This should probably be explained more precisely in the Pkg docs somewhere. Mind filing an issue over there? (UPDATE: See https://github.com/JuliaLang/Pkg.jl/issues/757)
更新:
一个人可以使用方法Base.load_path_expand(a::AbstractString)
来看看最终会发生什么:
One can play around with the method Base.load_path_expand(a::AbstractString)
to see what things become eventually:
julia> Base.load_path_expand.(LOAD_PATH.*"/test")
3-element Array{String,1}:
"\\test\\Project.toml"
"C:\\Users\\carsten\\.julia\\environments\\v1.0\\test\\Project.toml"
"C:\\Users\\carsten\\.julia\\environments\\stdlib\\test\\Project.toml"
这篇关于在我的Julia 1.0.0 REPL中,LOAD_PATH返回意外结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!