简体   繁体   中英

How to update Python in Anaconda base environment?

How can I update Python in the Anaconda base environment? Is Python intended to be upgradable in the base environment at all, or should one completely remove and reinstall Anaconda? Any version will eventually go out of support, so there should be some solution.

What I have tried so far, and did not result in Python getting updated:

  • conda update --all
  • conda update python and conda update anaconda
  • conda install python=3.9 or conda install anaconda=2021.11 do not finish after an hour and a half.
  • 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"
  • 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.

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.).

Official documentation by Anaconda advises against upgrading to another major version of Python. It mentions the method you have already tried:

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.

Run this command in the Anaconda prompt to update the base environment: conda update --all

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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