朱莉娅(Julia):我如何“解决"问题特定版本的软件包? [英] Julia: how I "fix" a package at a particular version?
问题描述
如何修复"特定版本的软件包?在朱莉娅?
How do I "fix" a package at particular version? in Julia?
这样,如果它破坏了现有代码,我们就不必更新程序包.
So that we don't have to update a package if it breaks existing code.
推荐答案
v1.0之后
我对这个问题的原始答案现在在语法上已经过时. @RikH提供了最新语法的答案.有关使用REPL软件包模式或常规REPL之间的语法差异的答案以外的其他信息,请在REPL上键入using Pkg
,然后输入?Pkg.PackageSpec
,以查看可以使用的软件包版本/提交方式示例.引用
My original answer to this question is now syntactically outdated. @RikH has provided an answer with the latest syntax. For additional info beyond that answer regarding the syntactical differences between working in the REPL package mode or the regular REPL, type using Pkg
, and then ?Pkg.PackageSpec
at the REPL to see examples of the ways in which package versions/commits etc can be referenced
v1.0之前的版本
官方文档.但是,我怀疑这个问题会经常被搜索到,所以加倍不会有什么害处.
The process for doing this is described pretty clearly in the official docs. However, I suspect this question will be searched for frequently, so perhaps it doesn't hurt to double up.
可以使用Pkg.pin
将软件包固定到特定版本.单一输入法会将软件包固定到当前版本:
Packages can be pinned to a specific version using Pkg.pin
. The single input method will pin the package to the current version:
julia> Pkg.pin("DependentBootstrap")
INFO: Creating DependentBootstrap branch pinned.b32df31a.tmp
julia> Pkg.status()
13 required packages:
...
- DependentBootstrap 0.1.0 pinned.b32df31a.tmp
- ForecastEval 0.1.0
您会注意到该软件包已固定到特定的git commit.
where you'll note the package has been pinned to a specific git commit.
您可以使用第二个参数固定到特定程序包的特定标记版本:
You can pin to a specific tagged version of a particular package using a second argument:
julia> Pkg.pin("DependentBootstrap", v"0.0.1")
INFO: Creating DependentBootstrap branch pinned.996d3c22.tmp
INFO: Downgrading ForecastEval: v0.1.0 => v0.0.1
INFO: Building SpecialFunctions
INFO: Building Rmath
julia> Pkg.status()
13 required packages:
...
- DependentBootstrap 0.0.1 pinned.996d3c22.tmp
- ForecastEval 0.0.1
请注意,为了满足版本要求,固定操作会自动降级ForecastEval
.
Notice that the pinning operation automatically downgraded ForecastEval
in order to satisfy version requirements.
您可以使用Pkg.free
将软件包恢复为最新的稳定版本:
You can get the package back to the latest stable version using Pkg.free
:
julia> Pkg.free("DependentBootstrap")
INFO: Freeing DependentBootstrap
INFO: Upgrading ForecastEval: v0.0.1 => v0.1.0
INFO: Building SpecialFunctions
INFO: Building Rmath
julia> Pkg.status()
13 required packages:
...
- DependentBootstrap 0.1.0
- ForecastEval 0.1.0
请注意,ForecastEval
也已自动返回到最新版本.
Notice that ForecastEval
has also automatically returned to the latest version.
这篇关于朱莉娅(Julia):我如何“解决"问题特定版本的软件包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!