3

我正在使用Pkg模块安装一个包:

using Pkg
Pkg.add("DataFrames")
Pkg.checkout("Flux")  # for the bleeding edge version of Flux

它失败了:

 Updating registry at `~/.julia/registries/General`
  Updating git-repo `git://github.com/JuliaRegistries/General.git`
 Resolving package versions...
 Installed InvertedIndices ─ v1.0.0
 Installed PooledArrays ──── v0.5.3
 Installed DataFrames ────── v0.20.2
  Updating `~/.julia/environments/v1.3/Project.toml`
  [a93c6f00] + DataFrames v0.20.2
  Updating `~/.julia/environments/v1.3/Manifest.toml`
  [a93c6f00] + DataFrames v0.20.2
  [41ab1584] + InvertedIndices v1.0.0
  [2dfb63ee] + PooledArrays v0.5.3

UndefVarError: checkout not defined

Stacktrace:
 [1] getproperty(::Module, ::Symbol) at ./Base.jl:13
 [2] top-level scope at In[1]:3

如何解决?

我的 Julia 环境:

julia> versioninfo()

Julia Version 1.3.1
Commit 2d5741174c (2019-12-30 21:36 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin18.6.0)
  CPU: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, skylake)
Environment:
  JULIA_NUM_THREADS = 4
4

1 回答 1

3

根据从 Julia v. 1.0 开始的文档Pkg,不再支持checkout功能。您可以使用以下方法执行相同的操作(并且更精简 - 不检查整个存储库):

Pkg.add(PackageSpec(name="Flux", rev="master"))   # you can use commit hash too

这相当于:

julia> ]
pkg> add Flux#master

您还可以使用特定版本的库:

julia> ]
pkg> add Flux@v0.10.3

(相当于Pkg.add(PackageSpec(name="Flux", version="v0.10.3"):)

于 2020-04-16T11:58:33.510 回答