Switching between Python 2 and Python 3 environments — Anaconda Enterprise 4.4 documentation

Anaconda Enterprise: Documentation

# Switching between Python 2 and Python 3 environments

You can easily maintain separate environments for Python 2 programs and Python 3 programs on the same computer, without worrying about the programs interacting with each other. Switching to an environment is called activating it.

## Summary

1. Create a Python 2 environment
2. Create a Python 3 environment
3. Activate and use the Python 2 environment
4. Deactivate the Python 2 environment
5. Activate and use the Python 3 environment
6. Deactivate the Python 3 environment

Create a Python 2 environment named py2, install Python 2.7:

    conda create --name py2 python=2.7

Create a new environment named py3, install Python 3.5:

    conda create --name py3 python=3.5

Now you have two environments to work with. You can install packages and run programs as desired in either one.

Activate and use the Python 2 environment

WINDOWS:

    activate py2

LINUX, macOS:

    source activate py2

Use your py2 environment to install packages and run programs as desired. When finished, deactivate the environment

WINDOWS:

    deactivate

macOS, LINUX:

    source deactivate

Activate and use the Python 3 environment

WINDOWS:

    activate py3

LINUX, macOS:

    source activate py3

Use the py3 environment to install and run programs as desired. When finished, deactivate the environment

WINDOWS:

    deactivate

macOS, LINUX:

    source deactivate