代码之家  ›  专栏  ›  技术社区  ›  Julia Learner anothershrubery

在myjulia1.0.0repl中,LOAD\u PATH返回意外结果

  •  3
  • Julia Learner anothershrubery  · 技术社区  · 7 年前

    My Julia REPL Help为加载路径提供了以下内容:

    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\u PATH的输出:

    julia> LOAD_PATH  # What is the output below?
    3-element Array{String,1}:
     "@"
     "@v#.#"
     "@stdlib"
    

    有什么建议吗?

    1 回复  |  直到 7 年前
        1
  •  4
  •   carstenbauer    7 年前

    DEFAULT_LOAD_PATH

    请允许我引用 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
    • "@stdlib" :将成为stdlibs的路径

    filing an issue over there ? (更新:请参阅 https://github.com/JuliaLang/Pkg.jl/issues/757

    更新:

    Base.load_path_expand(a::AbstractString) 最终变成什么:

    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"
    
    推荐文章