Command referenceconda activate
conda activate command (Linux & Windows / Conda)
What it does
Activate a named or path-based Conda environment in the current shell session. When people look up conda activate, they usually want safe flags, copyable examples, and how this Conda subcommand fits Anaconda or Miniconda workflows on Linux, Windows, and macOS. Syntax, options, and practical examples are below.
Activate a named or path-based Conda environment in the current shell session.
Syntax
conda activate [-n ENV | -p PATH | ENV]
Common options
| Flag / option | Meaning |
|---|---|
| ENV | Environment name or path to activate. |
| -n, --name | Activate by environment name. |
| -p, --prefix | Activate by prefix path. |
| base | Switch back to the base/root Conda environment. |
Practical examples
Activate by name
conda activate ml
Puts the ml environment on PATH for the current shell.
Return to base
conda activate base
Switches back to the default Conda installation environment.
Activate by path
conda activate ./envs/demo
Activates a prefix-based environment without a registered name.
Check after activate
conda activate web && python -V
Confirms which Python the activated env exposes.
Common mistakes
- Running `source activate` on modern Conda — use `conda activate` after `conda init`.
- Calling activate inside a non-initialized shell (CI script) without `conda run` or `source "$(conda info --base)/etc/profile.d/conda.sh"`.
- Assuming activation changes parent shells or IDE terminals automatically.
Related commands
- conda deactivateLeave the current Conda environment and restore the previous shell PATH stack.
- conda createCreate a new isolated Conda environment with an optional Python version and starter packages.
- conda initConfigure shell startup files so `conda activate` works in bash, zsh, PowerShell, cmd.exe, and others.
- conda runRun a command inside a Conda environment without permanently activating it in the parent shell.
- conda installInstall packages into the active or named Conda environment from configured channels.
- conda listList packages installed in the active or named Conda environment.
- conda env listList all Conda environments and mark the currently active one.
- aptSearch, install, update, and remove packages on Debian-based systems.
FAQ
What does conda activate do in Conda?
Activate a named or path-based Conda environment in the current shell session.
Does conda activate work on Windows and Linux?
Yes. Conda runs on Linux, Windows, and macOS; shell activation differs slightly after `conda init`, but the CLI flags are the same.
What is a practical conda activate example?
Try `conda activate ml` — Puts the ml environment on PATH for the current shell.
Is mamba the same as conda activate?
Mamba is a faster drop-in solver for many Conda workflows. Prefer `mamba` only when it is installed; otherwise use the Conda commands on this page.
Browse the full Linux and Windows command reference to search more bash, CMD, PowerShell, Conda, and GitHub CLI commands.