如果您使用的是 MacOS、Linux 或 Linux 的 Windows 子系统,我建议您尝试一下asdf(它不支持 Windows 本身,因为它可以在 Linux 类型的 shell 中运行)。它是一个处理版本的通用工具,并有一个 Julia 插件。一旦asdf安装完毕,只需执行
asdf plugin add julia
Run Code Online (Sandbox Code Playgroud)
添加julia插件。然后添加新版本的 Julia 就非常容易了。我这台计算机上没有安装 1.4.0(我安装了 1.5.1,我稍后会切换到它),所以我将通过安装来演示:
$ asdf install julia 1.4.0
Downloading from:
https://julialang-s3.julialang.org/bin/linux/x64/1.4/julia-1.4.0-linux-x86_64.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 94.3M 100 94.3M 0 0 5241k 0 0:00:18 0:00:18 --:--:-- 5932k
Run Code Online (Sandbox Code Playgroud)
现在它已安装,我可以将其设置为默认版本:
$ asdf global julia 1.4.0
Run Code Online (Sandbox Code Playgroud)
然后我就跑julia:
$ julia
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.4.0 (2020-03-21)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
Run Code Online (Sandbox Code Playgroud)
现在,如果我想将版本更改回1.5.1,非常简单:
$ julia
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.4.0 (2020-03-21)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
Run Code Online (Sandbox Code Playgroud)
如果您想要最新版本,只需执行asdf install julia latest. 要查看所有可用版本,asdf list all julia. 请注意,您似乎需要输入补丁版本号,例如asdf install julia 1.5.1,而不是asdf install julia 1.5。