Make Canopy v1 User Python be your default Python (i.e. on the PATH)

tl;dr -- Quick & easy method for a single terminal/command session

In Canopy 1.4 and above, you can make Canopy be the default Python for the duration of a single terminal session:

Windows: Open a "Canopy Command Prompt" window from the Canopy Tools menu. Please see Note #3 below.

Mac/Linux: Open a "Canopy Terminal" window from the Canopy Tools menu.

For more persistent settings, read on.


At the end of Canopy's initial setup, there is an option, which is selected by default, to make Canopy's Python be your default Python at the terminal / shell / command prompt. (This option will not apply to any terminal sessions that are already open, but rather to terminal windows opened subsequently.)

You might reasonably decide not to accept this default, for example if you are currently using another Python distribution (such as EPD) for production work, or do not want  .py files to be associated with Canopy's editor at this time. This will usually not affect operation inside the Canopy GUI application. 

However not making Canopy your default Python does complicate your ability to use Canopy Python from a command prompt, including installing external packages, because it may not be immediately obvious where Canopy's User Python is actually located if you want to refer to it explicitly. Canopy uses virtual environments as described here, so that  there are actually three Canopy Pythons. You should only use the Canopy User Python! Running the wrong Python (or IPython) will lead to confusing misbehavior.

How to check whether Canopy User Python is your default Python

Start python or ipython from a terminal session, do import sys; sys.prefix, and check that the output value ends in "Enthought/Canopy[something]/User" (specifically, it should match most of the path shown in the platform-specific table below. It should also match the value of sys.prefix that is shown when you type the same command in the Canopy GUI's Python panel. 

If you did not initially make Canopy your default Python, but would now like to make it so persistently, you have two options:

Set Canopy Preference - usually very easy but not for everyone:

Open the Canopy Preferences dialog (on the General tab) and click on "Set [Canopy] as default". 


  1. This does not always succeed; sometimes this Canopy GUI dialog can't actually decide whether Canopy Python would be the default in a terminal. We apologize for the inconvenience, and are working to improve the behavior. If this happens to you, we suggest using one of the other options below.
  2. This will subsequently cause the OS to open all python files, by default, in the Canopy editor (file association). This is the safest approach because it protects you from inadvertently running malicious scripts. After a python file has been opened in the Canopy editor, you can run it with a single keystroke. Nonetheless, this will be not be the desired behavior for all users, and in this case you should not use this functionality.
  3. (Windows): If you wish to use binary package installers such as Chris Gohlke's, this is your only option; such installers typically require that Windows registry entries be set, so just modifying PATH, as is done by the following options, will not suffice.

Manually set PATH - fairly easy:

To make Canopy be your default Python in all subsequent Terminal/Command sessions, you can manually prepend your PATH with the following platform-specific directory:


Word length
Windows XP  64 C:\Documents and Settings\<username>\Local Settings\Application Data\Enthought\Canopy\User\Scripts
Windows XP 32 C:\Documents and Settings\<username>\Local Settings\Application Data\Enthought\Canopy32\User\Scripts
Windows 7 & Vista 64 C:\Users\<username>\AppData\Local\Enthought\Canopy\User\Scripts
Windows 7 & Vista 32 C:\Users\<username>\AppData\Local\Enthought\Canopy32\User\Scripts
Mac OSX 64 ~/Library/Enthought/Canopy_64bit/User/bin
Mac OSX 32 ~/Library/Enthought/Canopy_32bit/User/bin
Linux 64 ~/Enthought/Canopy_64bit/User/bin
Linux 32 ~/Enthought/Canopy_32bit/User/bin

To do this: 

Linux or Mac OS X

Edit your ~/.bash_profile file, and uncomment (remove the initial "# " from) the line that looks like one of the following (depending on how early you installed Canopy; more details here):

# source [...] /activate
# VIRTUAL_ENV_DISABLE_PROMPT=1 source [...] activate

 (On some systems, this line will be in the ~/.profile or ~/.bashrc file. Wherever you find it, you can usually just uncomment it when you want Canopy to be your default Python. Note that if you have both .bash_profile and .profile on OSX, then only .bash_profile will be used, unless another config file explicitly invokes .profile .)


Editing the Windows PATH through the Control Panel (System / Advanced / Environment / User) is awkward and error-prone. We recommend using a utility such as the free Rapid Environment Editor, to back up your existing PATH settings, modify them, and/or switch between different PATH settings.

One possible source of confusion in Windows: if Canopy was installed for current user, and you already have a Python (e.g. EPD 7.3) which was installed for all users, then even if you specified that Canopy should be your default Python, the "all user" python default will take precedence. The way to override this is to modify the System PATH environment variable to begin with the Canopy Python directory, or to remove Python altogether from this environment variable. (Again, Rapid Environment Editor makes this much easier to do.) You will need admin permission to do this.


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


Undoing Canopy as the default Python

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

Manually changing file associations (.py in this case) is more difficult. The usual process, which applies to most applications including Canopy, is that when you install another application which you wish to assume control of a particular file association, it will do so for you. Metaphorically speaking, you change color by re-painting rather than by attempting to scrape off the previous layer.


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
    pierre puiseux

    Anyway it's not completely clear.

    From user point of view, Yes or No, setting/unsetting CanoPython as default python, is EQUIVALENT to uncomment/comment this line in the .profile user ?  

    VIRTUAL_ENV_DISABLE_PROMPT=1 source [...] activate

  • Avatar
    Marc Moncrief

    Hi. I very stupidly and very rashly deleted the lines above from by bash_profile. I have tried re-installing Canopy to replace the text, but this hasn't worked.

    I set up the environment in the default location, but did not make Canopy my default Python. Are you able to provide the text of the lines that Canopy adss to bash_profile so I can re-instate them?

  • Avatar
    Jonathan March

    @Marc, see the end of the "Environment setup" section of the Users Guide for your OS:

  • Avatar
    Deatrick Foster


    Is there an "activate" script for c-shell users (especially in the recently released version 1.2)?  I use tcsh as my shell for a number of reasons, so the bash-only activate script doesn't do me any good.  I know that using c-shell makes me a horrible person, but I can't switch to bash and would really like to use canopy-installed python at the command line for my work.  If there's no c-shell version of activate, could you please outline a useful workaround?  Many thanks for your help!

  • Avatar
    Jonathan March

    @Deatrick, you don't need activate at all; just write an alias that prefixes <home-dir>/Enthought/Canopy\_64bit/User/bin to your PATH.

  • Avatar
    Honglin Han

    I am unable to set Canopy as default right after installing. My system is 64-bit Mac OS X. I tried uninstall and remove all associate files then reinstall. I clicked on  "Start using Canopy", but it was unable to start the application.

  • Avatar
    dong qunxi

    The first time I use it and set the  Canopy to be my default Python. But now I want to cancel the option, how to do?

  • Avatar
    Sharath Chandra Guntuku

    When I start python, I get the following:

    Enthought Canopy Python 2.7.6 | 64-bit | (default, Jan 29 2014, 17:35:36)

    [GCC 4.1.2 20080704 (Red Hat 4.1.2-52)] on linux2

    Does this mean it is running GCC version 4.1.2?

    I am working with CUDA and that throws an error that gcc 4.6 and up are not supported. Is there any workaround for making GCC 4.1.2 system-wide?

    I am on a cluster and do not have root access!

    Thanks :)

  • Avatar
    Jonathan March

    Update: simplified the article, reflecting that Canopy 1.4 provides a "Canopy Command Prompt" or "Canopy Terminal" command in the Tools menu.

  • Avatar
    Andrew Gin

    Under Win7 (64-bit) I forgot that I had Python 2.5 already on my computer when I installed Canopy 1.4.1975. I got the dreaded "Canopy is not your default Python environment" and the pushbutton 'Set as default' was disabled.

    An "import sys; sys.prefix" in python started from a terminal showed "C:\Python25" and in Canopy showed 'C:\Users\ACG\AppData\Local\Enthought\Canopy\User'.

    I read the above, but  did not want to delete the previous install or work with the registry.

    My Quick fix without deleting anything or messing with the registry was to rename the 'Python25' directory to 'Python25xx'. 

    Then 'import sys; sys.prefix' showed 'C:\Users\ACG\AppData\Local\Enthought\Canopy\User' in both the terminal launch python and Canopy .

    The 'Edit | Preference' tab dialog box in Canopy showed 'Canopy is your default Python environment' with the pushbutton labeled 'Unset as default' was enabled.

    Hope that helps someone.


Powered by Zendesk