DelimitedFiles的包错误

时间:2018-06-06 20:45:38

标签: julia

我尝试从文档(https://docs.julialang.org/en/latest/stdlib/DelimitedFiles/#DelimitedFiles.readdlm-Tuple{Any,AbstractChar,Type,AbstractChar})运行此示例代码:

using DelimitedFiles

x = [1; 2; 3; 4];
y = [5; 6; 7; 8];

open("delim_file.txt", "w") do io
    writedlm(io, [x y])
end

readdlm("delim_file.txt", '\t', Int, '\n')

但是我收到以下错误:

ERROR: LoadError: ArgumentError: Module DelimitedFiles not found in current path.
Run `Pkg.add("DelimitedFiles")` to install the DelimitedFiles package.
Stacktrace:
 [1] _require(::Symbol) at .\loading.jl:435
 [2] require(::Symbol) at .\loading.jl:405
 [3] include_from_node1(::String) at .\loading.jl:576
 [4] include(::String) at .\sysimg.jl:14
 [5] process_options(::Base.JLOptions) at .\client.jl:305
 [6] _start() at .\client.jl:371
while loading E:\Dropbox\computer_sync_hardlink\julia\beispiel\beispiel.jl, in expression starting on line 1

当runng Pkg.add("DelimitedFiles")时:

ERROR: unknown package DelimitedFiles
macro expansion at .\pkg\entry.jl:53 [inlined]
(::Base.Pkg.Entry.##1#3{String,Base.Pkg.Types.VersionSet})() at .\task.jl:335
Stacktrace:
 [1] sync_end() at .\task.jl:287
 [2] macro expansion at .\task.jl:303 [inlined]
 [3] add(::String, ::Base.Pkg.Types.VersionSet) at .\pkg\entry.jl:51
 [4] (::Base.Pkg.Dir.##3#6{Array{Any,1},Base.Pkg.Entry.#add,Tuple{String}})() at .\pkg\dir.jl:33
 [5] cd(::Base.Pkg.Dir.##3#6{Array{Any,1},Base.Pkg.Entry.#add,Tuple{String}}, ::String) at .\file.jl:59
 [6] withenv(::Base.Pkg.Dir.##2#5{Array{Any,1},Base.Pkg.Entry.#add,Tuple{String},String}, ::Pair{String,String}, ::Vararg{Pair{String,String},N} where N) at .\env.jl:157
 [7] #cd#1(::Array{Any,1}, ::Function, ::Function, ::String, ::Vararg{String,N} where N) at .\pkg\dir.jl:32
 [8] add(::String) at .\pkg\pkg.jl:117

我真的不知道它有什么问题。

1 个答案:

答案 0 :(得分:1)

您正在阅读julia开发版的文档(请注意URL中的/latest/),但在运行代码时可能正在使用Julia v0.6(可能)。以下是与您的安装相匹配的文档:https://docs.julialang.org/en/v0.6.0/stdlib/io-network/#Base.DataFmt.readdlm-Tuple{Any,Char,Type,Char}

在Julia v0.6上,如果只删除using DelimitedFiles,则您的示例