How does conda's source activate foo work

6,732

Found details for the builtin source in ss64's man pages.

Unless you provide an exact path to filename then bash will look first via the PATH variable and then in the current directory (only if filename is not found in $PATH.) If any arguments are supplied, they become the positional parameters when filename is executed. Otherwise the positional parameters are unchanged.

So,

source activate <env-name>

is calling /Users/dilum/anaconda/bin/activate and passing the desired environment name as an argument.

Share:
6,732

Related videos on Youtube

Dilum Ranatunga
Author by

Dilum Ranatunga

Updated on September 18, 2022

Comments

  • Dilum Ranatunga
    Dilum Ranatunga over 1 year

    Anaconda's documentation for managing environments states that activating an environment is done using:

    source activate <env-name>
    

    I've noticed that with conda installed, activate is in the path:

    $ which activate
    /Users/dilum/anaconda/bin/activate
    

    Does source find files in the path as well? And I suppose the second parameter (the environment-name) is simply processed by the activate script?