简体   繁体   English

Anaconda基础环境如何更新Python?

[英]How to update Python in Anaconda base environment?

How can I update Python in the Anaconda base environment? Anaconda基础环境下如何更新Python? Is Python intended to be upgradable in the base environment at all, or should one completely remove and reinstall Anaconda? Python 是否打算在基本环境中升级,或者应该完全删除并重新安装 Anaconda? Any version will eventually go out of support, so there should be some solution.任何版本最终都会 go 失去支持,所以应该有一些解决方案。

What I have tried so far, and did not result in Python getting updated:到目前为止我已经尝试过,但没有导致 Python 得到更新:

  • conda update --all
  • conda update python and conda update anaconda conda update pythonconda update anaconda
  • conda install python=3.9 or conda install anaconda=2021.11 do not finish after an hour and a half. conda install python=3.9conda install anaconda=2021.11一个半小时后仍未完成。
  • mamba install python=3.9 results in "package python_abi-3.7-2_cp37m requires python 3.7.*, but none of the providers can be installed" mamba install python=3.9导致“包 python_abi-3.7-2_cp37m 需要 python 3.7.*,但无法安装任何提供程序”
  • No other suggestion is put forward here .在此不再提出其他建议。

I had a similar problem:我有一个类似的问题:

conda install anaconda=2022.10 resulted in unresolvable conflicts, conda install python=3.9 as well. conda install anaconda=2022.10导致无法解决的冲突, conda install python=3.9也是如此。

I finally managed to update by specifying both requirements within the same update command:我终于设法通过在同一个更新命令中指定这两个要求来更新:

conda install anaconda=2022.10 python=3.9

In the base environment, run mamba update python --no-pin (of course, you could do it with conda , but then you're up for a long wait.).在基础环境中,运行mamba update python --no-pin (当然,您可以使用conda来完成,但是您需要等待很长时间。)。

Official documentation by Anaconda advises against upgrading to another major version of Python. It mentions the method you have already tried: Anaconda 的官方文档建议不要升级到 Python的另一个主要版本。它提到了您已经尝试过的方法:

conda install python=3.9

but the process did not finish for you.但是这个过程并没有为你完成。 This is in line with their documentation which says:这与他们的文档一致,其中说:

It is not recommended, rather it is preferable to create a new environment.不推荐,最好创建一个新环境。 The resolver has to work very hard to determine exactly which packages to upgrade.解析器必须非常努力地确定要升级哪些包。

Instead, you should create a new environment as suggested by the documentation and answers to this question .相反,您应该按照文档此问题的答案所建议的创建一个新环境。

conda create -n py39 python=3.9 anaconda
  1. Open the Anaconda prompt by searching for it in the start menu or by running "anaconda-prompt" in the command prompt.通过在开始菜单中搜索或在命令提示符中运行“anaconda-prompt”来打开 Anaconda 提示符。

Run this command in the Anaconda prompt to update the base environment: conda update --all在 Anaconda 提示符下运行此命令以更新基础环境:conda update --all

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM