Almost a year ago, I installed Anaconda on my computer (a mid-2010 Mac upgraded with a SSD) to learn Python. I installed Python 3 but had to change to Python 2 because of a requirement for one of the online classes I wanted to take. Now, it looks like everything is finally trying to abandon Python 2.
So today I finally installed Python 3 in my mac while keeping Python 2.7. Googling it brought me to the conda site: “Managing Python”. Here, I found out I can do that by creating a separate environment.
conda create --name snakes python=3
Here I can use names other than “snakes”. To switch to this environment, I type the following in the console:
source activate snakes
While in the Python 3 environment, I tried to open jupyter notebook, and expected that my Python version would be 3. But no, that wasn’t the case. It was still python 2. I was hoping that I would be able to use python 3 in my notebooks by just switching to the python 3 environment. To fix this, I just opened the Anaconda Navigator (which I installed previously from the Anaconda website) and found the option to change environments. By switching to the python 3 (snakes, in my case) environment, I was able to install jupyter notebook by just clicking the install button.
After this, I can just type
jupyter notebook in the Python 3 environment. An alternative to installing Jupyter Notebook after creating the Python 3 virtual environment is using
pip install jupyter. See this Jupyter documentation.
Note, 9-1-2017: The documentation “Managing Python” is now updated to make what I went through with installing Jupyter Notebook below unnecessary.