When using conda of Anaconda or Mini-conda to create and manage a Python virtual environment, this kind of command is commonly used to activate and deactivate the target virtual environment:
source activate <conda-virtual-environment-name>How does this work? Firstly we need to know:
- source is a feature of bash shell. It is equivalent to . (a dot) of dash shell.
- bash manual page says
- ... filenames in PATH are used to find the directory containing filename. ...
If you could use the command, conda, your conda bin folder must be included in the environment variable PATH to make the command conda available to be searched and used. If you go to the same bin folder of conda path, you could see the files, activate and deactivate are in the same folder.
Thus, the command, source activate conda-virtual-environment, is actually
source <path-to-conda-bin-folder>/activate <conda-virtual-environment-name>
<conda-virtual-environment-name> is just the argument of the executable file, activate. Read the file activate would help you to understand how the virtual environment is launched/activated.
By the way, the recent conda is going to use conda activate to replace the conventional source activate.