Press enter to see results or esc to cancel.

Use Enthought Canopy’s Python with Oh-My-Zsh

Enthought’s instructions on how to use their Python as the default Python in your terminal are bash specific, so you might be a little confused on how to accomplish the same thing within your Zsh shell. Simply edit your .zshrc (if using vim: vi ~/.zshrc) and find the part that begins with export PATH="/usr/bin:/....". This line tells the shell where to look for different packages and in which order to look for them. You need to prepend the PATH so the shell first looks for packages in your Enthought Canopy’s bin folder, like so:

I believe lines 55 and 56 do the same thing, with line 56 running a script to essentially do what line 55 does. I haven’t found any difference when using one or the other, but personally I use the one on line 55, which just prepends your existing PATH. Just use one line or the other by commenting or uncommenting with the # sign. The last thing to consider is that your path in line 55 might be different than mine, depending on whether or not you have the 64- or 32-bit version. Just change the path accordingly. Once you open a new terminal window, run Python and you should see that you’re now running Canopy’s Python:

Your shell will also have access to things like IPython notebook, which is found in Canopy’s library. If you don’t want to use Canopy anymore just comment out line 55 above in your .zshrc file.

Conveniently, Oh My Zsh has a virtualenvwrapper plugin that you can use to automate this process using a virtual machine if, for example, you only want to use Canopy when working in certain folders.