Initialize Conda for your Windows shell by launching Anaconda Prompt from the Start Menu and running conda init (e.g., conda init powershell or conda init cmd.exe), or add your Anaconda/Miniconda installation directories (...\anaconda3\Scripts and ...\anaconda3\condabin) to your Windows User Path environment variable—because the Windows installer leaves conda off the system PATH by default to prevent DLL conflicts with other Python installations.
Basic Example
# 1. Recommended: Open "Anaconda Prompt" (or "Anaconda PowerShell Prompt") from the Windows Start Menu,
# then register `conda` with your regular Command Prompt and PowerShell shells:
conda init cmd.exe powershell
# 2. If PowerShell blocks the newly created profile script with an ExecutionPolicy error,
# allow local signed/user scripts in standard PowerShell:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
# 3. Close and reopen your regular PowerShell or Command Prompt window, then verify:
conda --version
# Output: conda 24.x.x (or 25.x.x)
# Alternative (if you cannot find Anaconda Prompt): Invoke `conda.exe` directly by full path
# to run `conda init` from any standard PowerShell window:
& "$env:USERPROFILE\anaconda3\Scripts\conda.exe" init cmd.exe powershell
# (For Miniconda, replace `anaconda3` with `miniconda3`; for all-users installs, use `C:\ProgramData\anaconda3`.)
Key Details & Edge Cases
- Why
conda initis preferred over manually editing WindowsPATH:- Simply adding
anaconda3\ScriptstoPATHmakesconda --versionwork, butconda activate myenvwill still fail withCommandNotFoundError: Your shell has not been properly configured to use 'conda activate'untilconda initinjects the shell hook function into PowerShell’sor Command Prompt’s AutoRun registry key.
- Simply adding
- Locating your Anaconda / Miniconda installation folder when
condais missing:- Check the three standard Windows installation paths in order:
- Per-user Anaconda:
C:\Users\<YourUsername>\anaconda3\ - Per-user Miniconda / Miniforge:
C:\Users\<YourUsername>\miniconda3\orC:\Users\<YourUsername>\miniforge3\ - System-wide (All Users) install:
C:\ProgramData\anaconda3\orC:\ProgramData\miniconda3\
- Per-user Anaconda:
- Check the three standard Windows installation paths in order:
- Manual
PATHentries if third-party IDEs (VS Code, PyCharm, Git Bash) still cannot findconda:- Press
Win + R, runsysdm.cpl$\rightarrow$ Advanced $\rightarrow$ Environment Variables… $\rightarrow$ edit UserPath, and add these two folders (adjusting the root path to match your install):C:\Users\<YourUsername>\anaconda3\condabinC:\Users\<YourUsername>\anaconda3\Scripts
- Adding
condabinandScriptsexposesconda.bat/conda.exewithout placing the rootanaconda3\Python interpreter ahead of other system tools.
- Press
- Fixing
condain Git Bash on Windows (conda init bash):conda initwithout arguments only configurescmd.exe(andpowershelldepending on version). To enablecondainside Git Bash (MINGW64), runconda init bash, then restart Git Bash so~/.bash_profilesourcesconda.sh.
- Restarting open terminals and IDEs is mandatory:
- Already-open PowerShell, Command Prompt, and VS Code windows cache old environment variables and startup profiles in memory. Close all terminal tabs (or restart VS Code completely) after running
conda initbefore testingconda --version.
- Already-open PowerShell, Command Prompt, and VS Code windows cache old environment variables and startup profiles in memory. Close all terminal tabs (or restart VS Code completely) after running
Comparison of Fixes for 'conda' is not recognized on Windows
| Method | Enables conda --version? |
Enables conda activate <env>? |
Works in Standard PowerShell / CMD / VS Code? | Best Used When |
|---|---|---|---|---|
conda init cmd.exe powershell (via Anaconda Prompt or full path) (Recommended) |
Yes | Yes (installs full shell activation hooks) | Yes (after restarting terminal) | Standard fix on Windows so both conda commands and conda activate work everywhere. |
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser |
N/A (unblocks PowerShell ) |
Yes (enables conda init hook in PowerShell) |
Yes (PowerShell) | PowerShell throws running scripts is disabled on this system after running conda init. |
Adding ...\condabin and ...\Scripts to User Path |
Yes | No (requires conda init for activate) |
Yes | External GUI apps or scripts looking up conda.exe / conda.bat via PATH without a shell profile. |
Using Anaconda Prompt from Start Menu |
Yes | Yes | Only inside that dedicated prompt window | Quick one-off work without modifying global shell profiles or PATH. |
You must log in or register to comment.
