简体   繁体   中英

How to change Python version of existing conda virtual environment?

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.

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

conda activate my_env
conda install python=3.6

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

Adding to the answer above

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

If you already have existing python installation may be in other environment, you can simply use it as base.

Here's what you need to do:

conda activate base
conda install python=3.6

Note: This will activate root environment. and python 3.6 already installed, it will simply replace it.

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