Switching between environments#

You can maintain separate environments for various versions of Python on the same computer without worrying about the programs interacting with each other. Switching to an environment is called activating it.

  1. Create an environment named env1 containing Python 3.10:

    conda create --name env1 python=3.10
    
  2. Create a new environment named env2, containing Python 3.11:

    conda create --name env2 python=3.11
    

    Now you have two environments with two different versions of Python. You can install packages and run programs as desired in either one.

  3. To work in the first environment, activate it by running the following command:

    conda activate env1
    
  4. To switch to the second environment, activate it by running the following command:

    conda activate env2
    

It is best practice to deactivate your environment when you are finished working in it. To deactivate your active environment, run the following command:

conda deactivate