How to change Python version of existing conda virtual environment?

PythonVersionCondaVirtual Environment

Python Problem Overview


I created a conda environment with Python version 3.8, but it doesn't support matplotlib... So I am looking for something like this to change the Python version: conda env my_env update to python=3.6. Is this possible or do I need to recreate the environment?

I have miniconda installed.

Python Solutions


Solution 1 - Python

Activate the relevant environment, then install your target python version.

conda activate my_env
conda install python=3.6

Solution 2 - Python

Adding to the answer above

conda activate my_env
conda uninstall python
conda install python=x.x

Solution 3 - Python

Rebuild a new environment, for example called "myenvi"

conda create --name myenvi python=3.6

And make sure the version by

python --version

After installing all packages, double-check with

conda list -n myenvi

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionelixirtripView Question on Stackoverflow
Solution 1 - PythonAlexanderView Answer on Stackoverflow
Solution 2 - PythonjacktimView Answer on Stackoverflow
Solution 3 - PythonZhang JianView Answer on Stackoverflow