Preparation‎ > ‎

FAQ

1. I currently have Python 2.7.* (Anaconda 1.8.*) installed on my Mac. How would you suggest I install 3.5.* so as to keep access to 2.7.* for my existing scripts (I don't want to try and convert them to 3.0 at this point).

With conda it's actually easy to create multiple environments with different packages and switch between them. In fact a lot of people recommend creating one environment per project you work on, to avoid the issue where you upgrade library A to get a new feature you want for one thing you're doing, but then it breaks this other project you were working on with someone else... Plus it's useful for reproducibility to be able to say "these are the exact packages I'm using" or "please install these exact packages to a sandbox without messing up my regular environment".

In this case, you'll want to do something like:

# create the new environment
conda create --name bootcamp-env python=3.5 anaconda
# start using it
source activate bootcamp-env

IMPORTANT: you only have to run the first line once to create the env, but you have to run the second line again in every shell you start. Each time you open a new shell window, it'll default back to your original 2.7 environment until you run the 'source activate ...' command.

In general defaulting to 2.7 might be what you want, since that's what you use every day, but during the bootcamp itself this could get very confusing if you accidentally forget to run the command once and suddenly start getting weird issues trying to run the code examples... So for the bootcamp itself, we'd suggest editing your ~/.bashrc file to add the above 'source activate ...' line, right at the end of the file, so it gets run automatically in any new shells you open. Then at the end of the bootcamp you can just remove it again.

References:
http://continuum.io/blog/anaconda-python-3
http://conda.pydata.org/docs/using/envs.html
http://goobbe.com/questions/3946244/how-to-change-default-anaconda-python-environment

Comments