Make Canopy 2 User Python be your default Python

You can make Canopy's active Python environment be the default Python for the duration of a single terminal session:

Windows: Open a "Canopy Command Prompt" window from the Canopy Tools menu.

Mac/Linux: Open a "Canopy Terminal" window from the Canopy Tools menu. (Does not work on all Linux systems, see this article.)


Canopy provides a Python environment named "User" where you can run Python code. You can also optionally create and use other Canopy Python environments. These are all installed and managed by EDM as described in "Where are all of the Python packages in my Canopy Python Environments?".

While the "User" Python environment is the default Python inside the Canopy application, Canopy does not set it to be the default Python in your system's standard Command Prompt / Terminal. This is to avoid interfering with the functioning of scripts which may already assume that another Python is the default. 

However, you may wish to make the Canopy "User" or other Canopy Python environment be the default Python on your system, so that you can immediately run Canopy Python (and ipython, jupyter, and other executables) from any command line.

Here are the OS-specific directories where the Canopy User Python executables are usually located. 


Windows 7 & above (64-bit) C:\Users\<username>\AppData\Local\Enthought\Canopy\edm\envs\User\Scripts
Windows 7 & above (32-bit) C:\Users\<username>\AppData\Local\Enthought\Canopy32\edm\envs\User\Scripts
MacOS ~/Library/Enthought/Canopy/edm/envs/User/bin
Linux ~/.local/share/canopy/edm/envs/User/bin

For the location of a different Canopy Python environment, replace "User" by the other environment name.

To make Canopy "User" Python be the default in a Command Prompt or Terminal, prepend this OS-specific path to your PATH environment variable.

To check whether Canopy Python is your default Python

Start python or ipython from a terminal session, then enter the commands

import sys

Check that the output value matches the path shown in the platform-specific table above (up to the environment name "User"). It should also match the value of sys.prefix that is shown when you type the same commands in the Canopy GUI's Python panel.

To set Canopy User Python as your default Python

To make Canopy's User Python be your default Python in all subsequent new Terminal/Command sessions, you can begin your PATH environment variable with the platform-specific directory shown in the table above. Here are recommended ways to do this:


Edit your ~/.bashrc file, and enter the following line at the end:

source '/Users/<username>/Library/Enthought/Canopy/edm/envs/User/bin/activate' 


Edit your ~/.bashrc file, and enter the following line at the end:

source '/home/<username>/.local/canopy/edm/envs/User/bin/activate' 


Prepend the Canopy User Python path shown in the table above to your PATH environment variable (usually the User PATH variable, not the System PATH variable), using the techniques described in "Editing environment variables on Windows"

To un-set Canopy User Python as the default Python

To remove Canopy from your PATH, reverse the (OS-specific) process described above.


Please do not enter support requests in article comments

Please use article comments for suggestions to improve the article. For individual support requests, please follow these guidelines.

Have more questions? Submit a request


Powered by Zendesk