PATH返回意外结果

PATH返回意外结果

本文介绍了在我的Julia 1.0.0 REPL中,LOAD_PATH返回意外结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的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

换句话说,

这可能应该在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返回意外结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 06:03