Skip to content

python: Change version

cmoeckel91 edited this page Jul 13, 2018 · 8 revisions

Sometimes it can be helpful to switch between python versions 2<->3. Follow these points to switch between them.

Combined

  1. Install and create a new environment directly: conda create --name <name> python=x.x
    conda create --name py36 python=3.6

Make sure IPython calls the right python version

If not follow these steps, and go to your environment:

  1. cd $HOME/anaconda/envs/<name>/bin
  2. vi ipython
  3. change the version of python to use in the first line (#!<pwd>/python -> #!<pwd>/pythonx.x)

Step by step

  1. Install an alternative python environment
    conda install python=2.7.8
    or
    conda install python=3.6.1

  2. Create an environment for the old and the new python environment
    conda create -n py36 python=3.6.1 anaconda
    conda create -n py27 python=2.7.8 anaconda

  3. Change to the new environment
    source activate py36

Clone this wiki locally