Search code examples
anacondaconda

Conda deactivate switches back to previous environment


I noted that if I run

conda activate myenv1
conda activate myenv2
conda deactivate

then myenv1 is active. I would rather expect - after these three lines - no environment to be active at all.

So it seems that conda deactivate switches back to previously active environment (which I find a bit inconvenient).

Is this expected? If so where is it documented?


Solution

  • It is in the documentation:

    By default, conda activate will deactivate the current environment before activating the new environment and reactivate it when deactivating the new environment.

    So it is expected