如何降级conda版本?

How to downgrade conda version?

我需要在我的 CentOS 6.7 机器上将我的 conda 版本从 4.3 降级到 4.2。 执行此操作所需的命令是什么?

我不建议降级 conda 除非新安装(升级)的版本有严重错误。

但是既然你问了:你可以通过将 ={version} 附加到包来指定一个版本,这甚至适用于 conda 包:

$ conda install conda=4.2

如果您想要特定的 4.2 版本,您还可以使用(例如):

$ conda install conda=4.2.15

请注意,降级 conda 可能非常危险。降级后,您的 conda 可能会完全失败或无法正常工作。 Conda 使用大量随时间演变的元数据......因此,如果降级的 conda 版本无法理解这些 - 或者更糟的是破坏它们 - 你将在如何恢复你的 conda 环境方面经历痛苦的​​经历。 降级 conda 风险自负(我认为只有在真的,真的 有必要时才这样做)!


如果您已经降级 conda 并且它向您抛出异常(例如 CondaUpgradeError),那么 troubleshooting guide in the conda repository 中的 "section" 可能会有用:

Conda upgrade error

Cause

Downgrading conda from 4.6.1 to 4.5.x and then trying to conda install conda or conda upgrade conda will produce a solving and upgrade error similar to the following:

Solving environment: failed
CondaUpgradeError: This environment has previously been operated on by a
conda version that's newer than the conda currently being used. A newer
version of conda is required.
target environment location: /opt/conda
current conda version: 4.5.9
minimum conda version: 4.6

Solution

Change the .condarc file. Set the parameter by editing the .condarc file directly: allow_conda_downgrades: true in conda version 4.5.12. This will then let you upgrade. If you have something older than 4.5.12, install conda 4.6.1 again from the package cache.

EXAMPLE: If my conda info says package cache : /opt/conda/pkgs and my Python version is 3.7, then on the command line, type conda install /opt/conda/pkgs/conda-4.6.1-py37_0.tar.bz2 to resolve the issue.