page

Feb 11, 2020

Conda - Switching between Python 2 and Python 3 environments

https://docs.anaconda.com/anaconda/user-guide/tasks/switch-environment/


first, you need to install miniconda (minimal installer for conda)
https://docs.conda.io/en/latest/miniconda.html

1. create python 2.7 environment
 [lee@ko44 ~]$ conda create --name py2 python=2.7


2. create python 3.7 environment
 [lee@ko44 ~]$ conda create --name py3 python=3.7


3. activate python 2 environment
 [lee@ko44 ~]$ conda activate py2

 then, you can see (py2) in terminal
 (py2) [lee@ko44 ~]$

4. deactivate python 2 environment
 (py2) [lee@ko44 ~]$ conda deactivate

 then, you will not see (py2) in terminal
  [lee@ko44 ~]$