Skip to content

How to Initialize VS Code terminal with the Anaconda terminal as default instead of powershell

If you use Python for research, data science, or machine learning, you already know the comfort of the Anaconda Prompt. It activates your environment automatically, sets up your PATH correctly, and just works.

But when you switch to Visual Studio Code, the default terminal is… well, just a terminal. No conda environment, no activation, no familiar setup.

Let’s fix that. In this post, you’ll learn how to make VS Code open a terminal that behaves exactly like the Anaconda Prompt—every time you press Ctrl+`.

🌟 Why You Want Anaconda Inside VS Code

VS Code is powerful, but its terminal doesn’t automatically activate conda environments. That leads to:

  • Python pointing to the wrong interpreter
  • conda not being recognized
  • Packages “missing” even though you installed them
  • Confusion about which environment you’re actually using

By initializing VS Code’s terminal with Anaconda, you get:

  • Automatic activation of your base (or chosen) environment
  • Correct PATH and environment variables
  • A seamless workflow between editor and terminal

It’s the best of both worlds.

🔧 Step-by-Step: Make VS Code Use the Anaconda Prompt

1. Locate your Anaconda activation script

On Windows, Anaconda Prompt is just cmd.exe running a special script:

For Miniconda:

Code

C:\Users\<yourname>\miniconda3\Scripts\activate.bat

For Anaconda:

Code

C:\Users\<yourname>\anaconda3\Scripts\activate.bat

This script is the magic ingredient.

2. Add a custom terminal profile in VS Code

Open VS Code → Settings → search for:

Code

terminal.integrated.profiles.windows

Click Edit in settings.json.

Add this block:

json

"terminal.integrated.profiles.windows": {
    "AnacondaPrompt": {
        "path": "C:\\Windows\\System32\\cmd.exe",
        "args": [
            "/K",
            "C:\\Users\\<yourname>\\miniconda3\\Scripts\\activate.bat"
        ]
    }
},
"terminal.integrated.defaultProfile.windows": "AnacondaPrompt"

Replace <yourname> with your actual Windows username.

See also  Pip package installation specifications and Error fixed: pip install -U 'accelerate>=0.26.0' ERROR: Invalid requirement: "'accelerate": Expected package name at the start of dependency specifier 'accelerate

3. Open a new terminal

Hit Ctrl+`.

You should now see:

Code

(base) C:\Users\<yourname>

Congratulations—you’re running the Anaconda Prompt inside VS Code.

🎯 Optional Tweaks

Activate a specific environment automatically

If you want VS Code to always start in, say, myenv:

json

"args": [
    "/K",
    "C:\\Users\\<yourname>\\miniconda3\\Scripts\\activate.bat myenv"
]

Use PowerShell instead of cmd

Prefer PowerShell? No problem.

json

"terminal.integrated.profiles.windows": {
    "AnacondaPS": {
        "path": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
        "args": [
            "-NoExit",
            "-Command",
            "C:\\Users\\<yourname>\\miniconda3\\Scripts\\activate.ps1"
        ]
    }
},
"terminal.integrated.defaultProfile.windows": "AnacondaPS"

🧪 Quick Test

Run:

Code

conda info

If you see your environment details, everything is working perfectly.

🚀 Final Thoughts

Integrating Anaconda with VS Code transforms your workflow. You get:

  • A consistent Python environment
  • Fewer path issues
  • Cleaner project setups
  • A terminal that behaves exactly the way you expect

It’s a small configuration change with a big payoff.


Discover more from Knowledge sparks

Subscribe to get the latest posts sent to your email.

Leave a Reply

error: Content is protected !!