Python 如何降级 conda 版本?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/41700715/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to downgrade conda version?
提问by Madhavi Jouhari
I need to downgrade my conda version from 4.3 to 4.2 on my CentOS 6.7 machine. What is the command required to do that?
我需要在我的 CentOS 6.7 机器上将我的 conda 版本从 4.3 降级到 4.2。执行此操作所需的命令是什么?
回答by MSeifert
I wouldn't recommend downgrading conda
except when the newly installed (upgraded) version has a critical bug.
我不建议降级,conda
除非新安装(升级)的版本存在严重错误。
But since you asked: You can specify a version by appending ={version}
to the packages, this works even for the conda
package:
但是既然你问:你可以通过附加={version}
到包来指定一个版本,这甚至适用于conda
包:
$ conda install conda=4.2
If you want a specific 4.2
version you can also use (for example):
如果你想要一个特定的4.2
版本,你也可以使用(例如):
$ conda install conda=4.2.15
Note that downgrading conda can be very risky. After the downgrade your conda
could fail completely or work incorrectly. Conda uses a lot of metadata that evolve over time ... so if the downgraded conda version cannot make sense of these - or even worse corrupt them - you'll have a painful experience in how to recover your conda environemnt. Downgrade conda at your own risk(and in my opinion only if really, reallynecessary)!
请注意,降级 conda 可能非常危险。降级后,您conda
可能会完全失败或无法正常工作。Conda 使用了许多随着时间推移而演变的元数据......因此,如果降级的 conda 版本无法理解这些 - 或者更糟的是损坏它们 - 您将在如何恢复 conda 环境方面遇到痛苦的经历。降级 conda 的风险由您自己承担(在我看来,只有在确实非常有必要的情况下)!
In case you already downgraded conda
and it's throwing exceptions (for example CondaUpgradeError
) at you, then maybe this "section" in an troubleshooting guide in the conda repositorymay be useful:
如果您已经降级conda
并且它向您抛出异常(例如CondaUpgradeError
),那么conda 存储库中故障排除指南中的这个“部分”可能会有用:
Conda upgrade error
Cause
Downgrading conda from 4.6.1 to 4.5.x and then trying to
conda install conda
orconda 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
sayspackage cache : /opt/conda/pkgs
and my Python version is 3.7, then on the command line, typeconda install /opt/conda/pkgs/conda-4.6.1-py37_0.tar.bz2
to resolve the issue.
Conda 升级错误
原因
将 conda 从 4.6.1 降级到 4.5.x,然后尝试
conda install conda
或conda upgrade conda
将产生类似于以下内容的解决和升级错误: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
解决方案
更改 .condarc 文件。通过直接编辑 .condarc 文件来设置参数:
allow_conda_downgrades: true
在 conda 版本 4.5.12 中。这将让您升级。如果您的版本早于 4.5.12,请从包缓存中再次安装 conda 4.6.1。示例:如果我
conda info
说package cache : /opt/conda/pkgs
并且我的 Python 版本是 3.7,则在命令行上键入conda install /opt/conda/pkgs/conda-4.6.1-py37_0.tar.bz2
以解决问题。