是否可以在 Anaconda 中锁定软件包的版本? [英] Is it possible to lock versions of packages in Anaconda?

查看:30
本文介绍了是否可以在 Anaconda 中锁定软件包的版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Windows xp 上安装了 Anaconda 3 2.3.0.它应该是 最新版本anaconda 支持 windows xp 因为它包含 python 3.4.3,python 3.4.x 是最后一个支持 windows xp 的 python 版本.

I installed Anaconda 3 2.3.0 on Windows xp. It is supposed to be the last version of anaconda to support windows xp as it contains python 3.4.3, and python 3.4.x is the last version of python to support windows xp.

使用

conda 安装

,它的依赖项之一是将 conda 更新到 conda 4.x.conda 4.x 在运行 conda install 时在命令行中崩溃.这使得 anaconda 无法使用,我卸载了 anaconda.

,one of its dependencies was updating conda to conda 4.x. conda 4.x crashed in the commandline when running conda install . This made anaconda unusable that i uninstalled anaconda.

我的问题,是否可以锁定包的版本?对于两个用例:

My question, is it possible to lock versions of packages ? For the two use cases:

  • 锁定并忘记:对于我从不希望它们更新的包,我需要运行一个命令来锁定它们一次,这样它们就永远不会作为依赖项更新
  • 忽略更新:安装包,同时忽略更新此更新中按名称传递的某些包.

如果 2 个用例中只有一个是可能的、已知的或更容易的,请将其写为答案.

If only one of the 2 use cases is possible or is known or is easier, please write it as answer.

推荐答案

这有两点.首先,您可以通过更改配置选项来防止 conda 自动更新 auto_update_condaFalse:

There are two bits to this. First, you can prevent conda from auto-updating by changing the configuration option auto_update_conda to False:

conda config --set auto_update_conda False

另一位是将包固定到某些版本.对于那些你不想更新的包,你可以通过在环境的 conda-meta目录.语法是

The other bit is to pin packages to certain versions. For those packages you don't want to update, you can pin the version by adding a line to a file called pinned (you might need to create it) in the environment's conda-meta directory. The syntax is

[下面的代码] [放置在 conda-meta/pinned] 强制 NumPy 停留在 1.7 系列,即任何以 1.7 开头的版本,并强制 SciPy 停留在完全相同的版本0.14.2:

[The code] below [placed in conda-meta/pinned] forces NumPy to stay on the 1.7 series, which is any version that starts with 1.7, and forces SciPy to stay at exactly version 0.14.2:

numpy 1.7.*
scipy ==0.14.2

请参阅 文档了解更多信息.

See the documentation for more information.

这篇关于是否可以在 Anaconda 中锁定软件包的版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆