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. (Note that on Windows, two directories are specified -- the first for python itself, the second for other executables.)


Windows 7 & above (64-bit) C:\Users\<username>\AppData\Local\Enthought\Canopy\edm\envs\User; 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; 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"


Command line aliases:

Alternatively, rather than having the Canopy environment active in your terminal anytime the terminal is opened, it is instead convenient to create a terminal alias to quickly activate the environment when needed. 


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

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


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

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


Please see the following article for further information on creating aliases for the Windows Command Prompt: Setting Command Aliases on Windows


After making these edits, save the .bashrc and then reopen the terminal. Now you should be able to activate the Canopy environment by executing the command:


The environment can be deactivated by executing the command:



macOS and Linux: Using Canopy python in an automated cronjob:

If you are automating the execution of a python script using cron, you may find that your script is being executed with the system python installation rather than the python provided by Canopy. This is because the cron job has a very limited scope of environment variables passed to it when execution begins. If you have manually edited your PATH variable in your .bashrc, .bash_profile, or .profile, then you will need to source that file before executing your python code in the cronjob.

For example, to run a script called with the python installed in the Canopy User python environment, assuming you have edited your .bash_profile with the correct PATH, you need to source this file then execute the python code. The command you execute with cron would then look similar to this:

source ~/.bash_profile && python


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


  • Avatar
    Alexandros Koukras

    Very helpful and detailed article.
    Thank you.

Powered by Zendesk