VS Code

How to Change Python Interpreter in VSCode

How to Change Python Interpreter in VSCode

Open the Command Palette, run Python: Select Interpreter, and pick an environment from the list. You can also click the Python version in the status bar. It opens the same list.

What shows up there comes from the Python Environments extension, which became generally available on February 18, 2026. It finds venv, conda, pyenv, Poetry and Pipenv environments along with whatever system Python installs you have.

A lot of older tutorials get one thing wrong now. Per the VS Code documentation dated 02/04/2026, picking an interpreter by hand writes a python-envs.pythonProjects entry to .vscode/settings.json. The setting most guides tell you to edit, python.defaultInterpreterPath, is only a legacy fallback, and it only kicks in the first time a workspace loads.

How to change the Python interpreter from the Command Palette or status bar

YouTube player

Both routes end at the same picker. The status bar is faster once you know where to click, and it also tells you which environment is active.

Select an interpreter with the Command Palette

  1. Open the project folder in VS Code, not just a single Python file.
  2. Press Ctrl+Shift+P on Windows and Linux, or Cmd+Shift+P on macOS.
  3. Type Python: Select Interpreter and press Enter.
  4. Pick an environment from the list.
  5. Check the status bar. The name and version you picked should sit at the bottom of the window.

Switching Python versions is the same process. You pick an interpreter that belongs to the other version. If it isn’t in the list, it probably isn’t installed yet, so install it first.

Select an interpreter from the status bar

Click the interpreter name at the bottom of the window and the list opens. No typing.

Normally that spot shows the active environment and its Python version. When nothing is selected, you get a warning there instead.

That warning usually means VS Code didn’t find anything it can use. Skip down to the next section if that’s you.

What the choice changes straight away

Run Python File now uses the interpreter you picked, and new terminals activate it automatically. If you are new to running a script from the editor, set the interpreter before your first run. Otherwise you’ll probably hit the classic “why is this Python 3.9?” moment.

The debugger’s Python File configuration follows the selection too.

How to point VS Code to an interpreter that is not in the list

YouTube player

At the top of the picker there’s an Enter interpreter path… option. Choose it and browse to the Python executable inside the environment. Anaconda’s docs point conda users to this same option, which opens a file dialog where you select python.exe.

Find the path first

The most reliable way, on any OS, is to ask Python itself. In a terminal where the right Python already works, run python -c "import sys; print(sys.executable)".

On macOS and Linux, which python3 also prints the location. Windows has where python, which lists every match on PATH (sometimes there are a surprising number of them).

Make sure the environment is active in that terminal. If it isn’t, you’ll copy the system Python’s path and wonder why nothing changed.

Typical executable paths

  • venv on Windows: .venv\Scripts\python.exe
  • venv on macOS or Linux: .venv/bin/python
  • conda on Windows: the python.exe file directly inside the environment’s folder under envs
  • conda on macOS or Linux: the bin/python file inside the environment’s folder under envs

If VS Code ignores the path you entered

There’s a Windows report on the Python extension’s issue tracker (microsoft/vscode-python #18231) where the status bar dropped back to “Select Python Interpreter” after someone chose python.exe manually. It’s from extension version 2021.12. I’d treat it as an example of how this can fail rather than a bug you should expect today.

Quick sanity check before trying again: run that path in a terminal with --version. No output means VS Code can’t use it either.

How to create a new environment and switch to it

Run Python: Create Environment, choose Venv, then pick a base interpreter. You’ll see a .venv folder appear in the workspace. Microsoft’s tutorial also has you run Python: Select Interpreter afterward to confirm the new environment is the selected one, which is worth doing.

Quick Create

In the Python sidebar, the Environment Managers view has a + button. That’s Quick Create. It builds a .venv with the latest Python it can find, installs dependencies from requirements.txt or pyproject.toml if either exists, and selects the new environment for you.

For most projects this is all you need, honestly.

Custom Create

Python: Create Environment is the slower route with more control. You choose venv or conda as the manager, then a Python version from the base interpreters the extension found. It also asks what to call the environment folder.

The last prompt is about dependencies, and it can install from requirements.txt, pyproject.toml or environment.yml.

What VS Code cannot create

Only venv and conda environments can be created from inside VS Code. Poetry, Pipenv and pyenv environments have to be built with their own command line tools. After that they appear in the list like anything else.

Terminal activation after creation

By default, every new terminal runs the activation command for you. You’ll see the command printed in the terminal.

If you ever need the manual route, there is a walkthrough on activating a venv by hand.

How VS Code finds interpreters

At activation, VS Code runs the Python Environment Tool (PET). It checks workspace folders for .venv folders, then PATH and system locations, plus the Windows Registry on Windows. It also looks wherever conda, pyenv, Poetry and Pipenv keep their environments.

Since the April 2026 release, Pipenv, pyenv and Poetry environments are no longer discovered eagerly at startup. Detection waits until you interact with one of those managers. So if a new environment is missing, run Python Environments: Refresh All Environment Managers before assuming something is broken.

Python extension and Python Environments extension

These are two separate extensions that work together. The Python Environments one adds environment and package management to the Python sidebar. Microsoft made it generally available on February 18, 2026, after about a year in preview.

You may still find guides from the July 2025 roll-out telling you to add “python.useEnvironmentsExtension”: true to settings.json. If a guide says that, check its date. It’s out of step with the current setup.

Where it looks

Out of the box, the extension searches .venv and */.venv inside workspace folders. The April 2026 release narrowed this from ./**/.venv, which scanned the entire workspace tree. That was slow on big repos, so the change makes sense.

Two settings extend the search. python-envs.workspaceSearchPaths works at workspace or folder level only. python-envs.globalSearchPaths takes absolute paths and lives at user level.

Virtual environments nested more than one level deep need a custom path added through python-envs.workspaceSearchPaths, according to Microsoft’s April 2026 release notes.

Environment managers compared

ManagerCreated in VS CodeDiscovered throughTool path setting
venvYesWorkspace .venv or venvSearch path settings
condaYesconda locationspython.condaPath
pyenvNo, discovered onlypyenv locationsNone listed
PoetryNo, discovered onlypoetry locationspython.poetryPath
PipenvNo, discovered onlypipenv locationspython.pipenvPath

Still choosing a tool? This comparison of venv, conda and Poetry covers the trade-offs.

What wins when nothing is selected

If you never pick anything, VS Code goes for a workspace-local .venv or venv first. Global interpreters come after that.

Older documentation describes different behavior. It said the extension used the first interpreter it found in the system path, and warned on macOS when that turned out to be the OS-installed Python. Go by the page dated 02/04/2026. That’s the current one.

Where VS Code stores the interpreter choice

When you pick an interpreter yourself, a python-envs.pythonProjects entry gets written to .vscode/settings.json. It records the environment manager (for example ms-python.python:venv). It does not store a hardcoded interpreter path.

The specific environment you chose is remembered somewhere else and resolved at runtime. Auto-selection doesn’t write anything at all. This is the reason the settings file can be shared across machines and teammates without breaking, which I think is a genuinely good design decision even if it confuses people at first.

Selection priority

Several settings can decide the interpreter, and VS Code takes the first one that matches. The order below follows the documentation dated 02/04/2026.

OrderSourceBehavior
1python-envs.pythonProjectsWritten by a manual choice in .vscode/settings.json
2python-envs.defaultEnvManagerRead only when you set it explicitly
3python.defaultInterpreterPathLegacy fallback, still supported
4Auto-discoveryApplies only when rows 1 to 3 are empty

What python.defaultInterpreterPath still does

It only applies the first time the extension loads for a workspace. You can give it a path to the interpreter or to a folder containing one, and variables such as ${workspaceFolder}/.venv work.

After a workspace has an interpreter selected, edits to this setting are not applied. VS Code itself never adds or changes it either.

That’s where people get stuck. Hand-editing python.defaultInterpreterPath is still a popular tip, but on a project that already has an interpreter selected, the edit does nothing. And a pythonProjects entry outranks it anyway.

If you do edit by hand, start by opening settings.json in VSCode and look for a pythonProjects entry first.

My advice is to just use the picker. python.defaultInterpreterPath still has a place in older setups, or as a first-open default for a fresh clone.

Can different folders use different interpreters?

They can. The feature is called Python Projects, and it maps an environment to a folder or file.

Once a folder is mapped, running, debugging, testing and terminal activation all use that project’s environment. Pylance doesn’t, though. More on that below.

Assign an environment to a folder

Right-click a folder in Explorer and choose Add as Python Project. If you have a lot of folders, Auto Find detects the ones that contain pyproject.toml or setup.py.

To undo it, use Remove Python Project. It drops the mapping and deletes no files.

Where it stops working

Pylance keeps one interpreter for the whole workspace, typically the one tied to the workspace root. So in a second folder, completions and import checks can follow the wrong environment. Running the code works fine while the editor underlines imports in red. Annoying.

A multi-root workspace fixes it (File, then Add Folder to Workspace), because Pylance runs independently per workspace folder.

Most repositories are fine with one environment per project. Python Projects earns its keep when one repo holds services or monorepo folders with different environments, or when you’re testing across Python versions. Add multi-root on top only if you need editor analysis to match as well.

What changes after you switch interpreters

The debugger, the integrated terminal, Jupyter notebooks and Pylance all follow the selection. Each one has its own quirk.

Debugger

A launch.json configuration can override the selection with its python property. Handy when one launch profile needs a different interpreter than the editor.

For breakpoints and launch profiles, see the guide to debugging Python in VSCode.

Integrated terminal

Terminal activation is controlled by python-envs.terminal.autoActivationType.

  • command is the current default. It runs the activation command visibly after the terminal opens and is the most compatible option
  • shellStartup activates the environment through shell integration or the shell’s startup script, so it’s ready before you type anything
  • off disables automatic activation, for people who’d rather do it themselves

Restart terminals after changing python-envs.terminal.autoActivationType. The older python.terminal.activateEnvironment setting still works, but the new setting takes precedence when it is configured.

Microsoft’s February 18, 2026 post says shellStartup will become the default in a future release. The settings reference lists it as supported for zsh, fish, pwsh, bash and cmd. If you try it and don’t like it, run Python Envs: Revert Shell Startup Script Changes to undo the edits.

Jupyter notebooks

Notebooks still discover environments through the older Python extension API, not the Python Environments API.

So the kernel list doesn’t always match the Environment Managers view. Two commenters on issue #1671 in the tracker hit exactly this when choosing a kernel. For both of them, installing Python into an empty conda environment fixed it.

Pylance

Pylance analyzes against whatever interpreter resolves. If none does, completions are the first thing to break. One Remote-SSH report on the Python extension tracker (#14935) describes the yellow “Select Python Interpreter” prompt refusing to go away while autocomplete failed to suggest os.makedirs().

Once an interpreter resolves, completions follow the packages installed in that environment.

Why the interpreter is missing or wrong, and how to fix it

A missing interpreter is usually a broken environment or a stale discovery cache. Conda causes its own share, either because VS Code can’t detect the conda install or because a conda environment has no Python in it. A wrong interpreter that keeps coming back is a different problem. That’s precedence.

Interpreter not listed

If the environment shows up marked (broken), pyvenv.cfg is missing or the Python executable is invalid. Recreate the environment or repair the files.

Created it a minute ago and it isn’t there? The discovery cache is stale. And if conda isn’t detected at all, put it on PATH or install it.

For a broken environment, removing it cleanly comes first. The steps for deleting a venv cover that before you recreate it.

For diagnosis, run Python Environments: Run Python Environment Tool (PET) in Terminal…, then choose Find All Environments or Resolve Environment…

Conda environments discovered but not listed

This one is documented and still unresolved. In microsoft/vscode-python-environments issue #1671, the output reports 9 discovered environments (1 Global, 8 Conda). The picker, meanwhile, shows only System Python, previously selected interpreters and the path and create options.

The reporter was on VS Code 1.130.0 and Python Environments extension 1.36.0 on macOS. A maintainer suspects the compatibility adapter fails on conda environments that contain no Python, and that one failure blocks the rest of the batch.

In the thread, two commenters made the problem go away by installing Python into the empty environment. Entering the interpreter path by hand worked the whole time, if you just need to get unstuck.

Wrong interpreter keeps coming back

  1. Open .vscode/settings.json and look for a python-envs.pythonProjects entry that covers the folder. Those entries outrank every other source.
  2. Pick the interpreter again from the status bar, or remove the mapping with Remove Python Project.
  3. If the behavior still looks wrong, disable the Python Environments extension. The core Python extension keeps working without it.

Remote hosts and containers

In WSL, VS Code installs its server inside the Linux environment and runs most extensions there, so they work with the tools installed in WSL rather than on Windows. SSH hosts and containers work the same way. The interpreter list belongs to that host, which is why Python that exists only on the local computer never appears when VS Code runs remotely.

If you work over SSH, the VS Code Remote SSH walkthrough covers the connection itself.

Local extensions that need to run remotely appear dimmed under Local – Installed until you install them on the remote host. Easy to miss.

The tracker has a couple of older Remote-SSH reports worth knowing about. #14935 shows the “Select Python Interpreter” prompt that will not clear, and #20785 has the extension stuck at “Discovering Python Interpreters”.

Containers follow the same pattern, because the Remote Development extensions open a folder in a container, over SSH or in WSL. Install the Python extension in that window first.

Python Interpreter in VSCode FAQ

What is a Python interpreter?

It’s the program that actually runs your code: python.exe on Windows, python on macOS and Linux. In VSCode, the selected interpreter decides which Python version and which installed packages the editor, debugger and terminal use.

Do I need to install Python before VSCode can list it?

Yes. VSCode doesn’t ship with a Python interpreter.

On Windows, VS Code can still find python.org installs through the Windows Registry even if you skipped the “Add Python to PATH” checkbox. Typing python in a terminal won’t work until it’s on PATH, though. If a new install doesn’t show up, close and reopen the terminal or restart VS Code.

How do I clear the selected interpreter?

Run Python: Clear Workspace Interpreter Setting from the Command Palette. Reports on the extension tracker use this command to reset a workspace.

The environments documentation describes no dedicated reset command. If you only want a different interpreter, picking another one from the status bar is simpler.

Can VSCode load a .env file into the terminal?

It can. Set python.terminal.useEnvFile to true, and VSCode injects the variables from a .env file into each terminal when it is created.

The default file is ${workspaceFolder}/.env, and python.envFile changes it. Open a new terminal after changing either setting.

Setting Up a New Project With the Right Python Interpreter

For a new project, I create a .venv in the workspace root, select it once from the picker, and commit .vscode/settings.json. python.defaultInterpreterPath stays unset.

The order matters a bit. The picker can only record an environment that already exists, so creating comes first. Committing goes last so the settings file holds the final choice.

There is a catch. The committed file stores the environment manager type, not the environment itself, and .venv folders generated by the Python Environments extension are git-ignored by default (Microsoft, July 2025 release notes). Every teammate ends up building a .venv of their own. That’s fine in practice, just don’t expect a fresh clone to come with a ready environment.

This position was verified on November 20, 2026 against the documentation dated 02/04/2026 and Microsoft’s April 2026 release notes. Recheck the priority order if later release notes retire python.defaultInterpreterPath.

Bogdan Sandu

Stay sharp. Ship better code.

Every week: one curated article, one tool worth knowing, one tip you can use tomorrow. No noise, no padding.