Nafiz Hamid    Blog

Setting up Ipython notebook with python3 through Conda

Recently, I have been studying the book Python Machine Learning by Sebastian Raschka. The book uses python 3 rather than python 2. My Mac OS had been setup with python 2 with Anaconda by Continuum Analytics. Anaconda is a python distribution that includes all essential packages needed for data science so that you do not need to worry about installing them yourself.

The great news is through their package management system Conda, you can just create a python 3 environment and open an ipython notebook from that environment that uses python 3.

On Mac OS, just type the following command -

alt text

py3k is your environment name, you can name it as you wish. Writing anaconda means you want all the packages. If you just want any specific package you can replace anaconda with that.

To activate the environment with python 3, write in your terminal-

alt text

and to deactivate-

alt text

To get the ipython notebook with python3, just activate the environment with python3 and open a notebook from the terminal. It should work fine. This stack overflow post was specially helpful.

comments powered by Disqus