CLI usage#
Run conda spawn --help
for details:
usage: conda spawn [-h] (-n ENVIRONMENT | -p PATH) [--hook]
[--shell {ash,bash,cmd.exe,cmd,csh,dash,fish,posix,powershell,pwsh,tcsh,xonsh,zsh}]
[--replace] [--stack]
[COMMAND [args] ...]
Activate conda environments in new shell processes.
positional arguments:
COMMAND [args] Optional program to run after starting the shell. Use
-- before the program if providing arguments.
options:
-h, --help Show this help message and exit.
Target Environment Specification:
-n ENVIRONMENT, --name ENVIRONMENT
Name of environment.
-p PATH, --prefix PATH
Full path to environment location (i.e. prefix).
Shell options:
--hook Print the shell activation logic so it can be sourced
in-process. This is meant to be used in scripts only.
--shell {ash,bash,cmd.exe,cmd,csh,dash,fish,posix,powershell,pwsh,tcsh,xonsh,zsh}
Shell to use for the new session. If not specified,
autodetect shell in use.
--replace Spawning shells within conda-spawn shells is
disallowed by default. This flag enables nested spawns
by replacing the activated environment.
--stack Spawning shells within conda-spawn shells is
disallowed by default. This flag enables nested spawns
by stacking the newly activated environment on top of
the current one.
Examples for --hook usage in different shells:
POSIX:
source "$(conda spawn --hook -n ENV-NAME)"
CMD:
FOR /F "tokens=*" %%g IN ('conda spawn --hook -n ENV-NAME') do @CALL %%g
Powershell:
conda spawn --hook -n ENV-NAME | Out-String | Invoke-Expression