How to install and switch Python version 2.7 <-> 3.5 in Anaconda

I recently had to switch to Python 2.7 since it is required for Algorithms and Data Structure unit. My current installation of Anaconda on my laptop is Python 3.5. This is the step by step solution to switch between two versions.

  1. Install Python 2.7 Environment
    conda create -n py27 python=2.7 anaconda

    This process take a looooooong time (10+ minutes). So feel free to have a dinner or find something else to do while waiting.

  2. Switch the environment
    source activate py27
  3. When you want to switch back to the current version. You can use:
    source deactivate

Note: You don’t have to switch the environment (step 2 and 3) to use other version of Python in Jupyter Notebook, because the new environment will show when creating new file.

screen-shot-2559-10-11-at-12-54-37-pm

Note 2: If you would like to install new package in Python 2.7, you have to activate in command line, then put the installation code in Terminal:

pip install pythonds

Reference: http://conda.pydata.org/docs/py2or3.html#use-a-different-version-of-python


Posted

in

, ,

by

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *