
Seeing “Python interpreter not found” or an empty interpreter list in Visual Studio Code can stop your Python project before you even run your first script. The good news is that this problem is usually caused by a missing Python installation, an unavailable PATH entry, an extension issue, or a virtual environment that VS Code has not discovered yet.
In this guide, you’ll learn seven practical ways to fix the Python interpreter not found error in VS Code on Windows, macOS, and Linux. Follow the checks in order, then test the selected interpreter with a small Python program.
Why Is Python Interpreter Not Found in VS Code?
Visual Studio Code is a code editor; installing it does not automatically install the Python programming language. You need a Python interpreter installed separately, as well as the Microsoft Python extension to add Python language features and interpreter selection to VS Code.
Common causes include:
- Python is not installed, or its installation is incomplete.
- The Python executable is not available through your system PATH.
- The Microsoft Python extension is missing, disabled, or not activated.
- VS Code is open to the wrong project folder or workspace.
- Your
.venvor other virtual environment has not been discovered. - VS Code has stale environment-discovery information.
- The interpreter path saved in workspace settings is no longer valid.
Before You Start: Check Your Python Installation
Open the VS Code terminal using Terminal → New Terminal. Run the command for your operating system.
| Operating system | Check Python | Check executable location |
|---|---|---|
| Windows | py --version |
where.exe python |
| macOS | python3 --version |
which -a python3 |
| Linux | python3 --version |
command -v python3 |
If the version command displays a Python version, an interpreter is available to that terminal. If it reports that the command cannot be found, continue with Fix 1. On Windows, the py launcher may work even when the python command does not.
Fix 1: Install Python on Your Computer
Download Python from the official Python downloads page. Choose the installer for your operating system and complete the installation.
Windows
- Download the Windows installer from Python.org.
- Run the installer and follow its setup options.
- If the installer offers an option to add Python to PATH, enable it when appropriate.
- Finish installation, close existing terminal windows, and open a new terminal.
- Run
py --versionorpython --versionto verify it.
macOS and Linux
Use the official installer or the recommended package manager for your operating system. On many macOS and Linux systems, the command is python3 rather than python. Avoid replacing or modifying an operating system-managed Python installation unless you understand the consequences.
Fix 2: Install or Enable the Microsoft Python Extension
Python itself and the VS Code Python extension are two different things. The interpreter runs your code; the extension provides Python support inside the editor.
- Open Visual Studio Code.
- Select the Extensions icon in the Activity Bar, or press
Ctrl+Shift+X(Windows/Linux) orCmd+Shift+X(macOS). - Search for Python.
- Install the extension published by Microsoft, or select Enable if it is already installed but disabled.
- Reload the VS Code window if prompted.
Make sure you are installing the Microsoft Python extension, not an unrelated extension with a similar name.
Fix 3: Select the Python Interpreter Manually
VS Code may have detected Python but not selected the interpreter for your current workspace.
- Open your project folder in VS Code using File → Open Folder.
- Press
Ctrl+Shift+Pon Windows/Linux orCmd+Shift+Pon macOS to open the Command Palette. - Search for Python: Select Interpreter.
- Select the Python installation or virtual environment that belongs to your project.
- If the interpreter is missing from the list, look for an option to enter or browse to its executable path, or continue to Fix 5 and Fix 6.
You can also select the Python environment shown in the VS Code Status Bar. The selected environment is used for running and debugging Python files and for Python language features.
Fix 4: Add Python to PATH (Windows)
If Python is installed but the python command is not recognised in a new terminal, Windows may not have the correct Python installation directory in PATH.
- First run
py --version. If this works, the Python launcher can still locate an installation. - Search Windows for Edit the system environment variables and open the Environment Variables dialog.
- Under your user variables, select Path and choose Edit.
- Add the correct Python installation directory and its
Scriptssubfolder only if they are not already present. The exact paths depend on where Python was installed. - Save the changes, close VS Code completely, reopen it, and test
python --version.
Important: Do not copy a path from another computer. Find your actual installation location first. If you are unsure, rerun the official Python installer and use its repair or modify options where available.
Fix 5: Recreate or Locate Your Virtual Environment
If you are working inside a virtual environment, the interpreter is stored inside that environment. A deleted, moved, or damaged environment can leave VS Code pointing to a path that no longer exists.
From the root of your project, create a new environment if you do not already have one:
# Windows
py -m venv .venv
# macOS or Linux
python3 -m venv .venv
Then select the environment interpreter in VS Code:
| Operating system | Typical interpreter path inside the project |
|---|---|
| Windows | .venv\Scripts\python.exe |
| macOS | .venv/bin/python |
| Linux | .venv/bin/python |
These are relative paths from the project folder. If your environment uses a different folder name, adjust the path accordingly. For a complete walkthrough, read our guide: How to Create a Python Virtual Environment in VS Code.
Fix 6: Refresh VS Code Environment Discovery
A newly created environment may not appear immediately if the environment list is out of date.
- Open the Command Palette.
- Search for Python Environments: Refresh All Environment Managers.
- Run the command and wait for discovery to complete.
- Run Python: Select Interpreter again.
If your environment is stored outside the project or in a custom folder, configure the Python Environments extension’s search paths at the workspace or user level as appropriate. For a workspace-specific .venv folder, the extension normally searches for that folder automatically. You can also inspect the Environment Managers view in the Python sidebar.
Fix 7: Check Workspace Settings and Restart VS Code
A workspace setting can point VS Code to an interpreter that has been moved or deleted. Open your project’s .vscode/settings.json file, if it exists, and inspect any Python interpreter-related configuration.
The legacy python.defaultInterpreterPath setting can provide a default interpreter path for a workspace the first time the Python extension loads it. Changing this setting after an interpreter has already been selected does not necessarily replace that selection. Use Python: Select Interpreter to make the current selection explicitly.
After correcting the path or selecting the right environment:
- Open the Command Palette.
- Run Developer: Reload Window.
- Open a new terminal using Terminal → New Terminal.
- Select the correct interpreter again if necessary.
How to Confirm the Python Interpreter Is Working
Create a file named check_python.py in your project and add this code:
import sys
print("Python is working!")
print("Version:", sys.version)
print("Interpreter path:", sys.executable)
Run the file using the Run Python File button or from the terminal:
python check_python.py
On systems where the command is python3, use python3 check_python.py. The output should show the Python version and the full path to the interpreter. If you selected a virtual environment, the path should point inside your project’s .venv folder.
Common Python Interpreter Problems and Solutions
| Problem | What to try |
|---|---|
| No interpreter appears in the list | Verify Python is installed, install or enable the Microsoft Python extension, then refresh environment discovery. |
python is not recognised on Windows |
Try py --version, then check the installation and PATH configuration. |
.venv is not detected |
Open the correct project folder, confirm the environment exists, and refresh environment managers. |
| Interpreter is marked broken | Check whether its executable and pyvenv.cfg still exist. Recreate the environment if it is damaged. |
| Imports are underlined or modules are missing | Select the environment where the package is installed, then install missing packages using python -m pip install package-name. |
| Terminal uses a different Python version | Choose the intended interpreter and open a new terminal. Check the executable path with python -c "import sys; print(sys.executable)". |
Frequently Asked Questions
Why does VS Code say no Python interpreter is selected?
VS Code may not have detected a Python installation, or an interpreter has not been selected for the current workspace. Confirm Python is installed, install the Microsoft Python extension, and run Python: Select Interpreter.
Do I need to install Python separately from VS Code?
Yes. VS Code is an editor and the Python interpreter is a separate installation. Install Python first, then add the Microsoft Python extension to VS Code.
How do I find my Python interpreter path?
Run python -c "import sys; print(sys.executable)" or, where appropriate, python3 -c "import sys; print(sys.executable)" in a terminal where Python works. On Windows, py -0p can also list installed Python versions and their paths.
Why is my .venv folder not showing in VS Code?
Make sure you opened the folder that contains the environment, confirm that the environment is valid, and run Python Environments: Refresh All Environment Managers. You can also browse directly to the environment’s Python executable.
Should I reinstall VS Code to fix the interpreter error?
Usually not. Start by checking the Python installation, extension, selected interpreter, environment folder, and discovery cache. Reinstalling VS Code is rarely the first troubleshooting step.
Final Thoughts
The Python interpreter not found error in VS Code is usually fixable without reinstalling your editor. Start by confirming that Python is installed, make sure the Microsoft Python extension is enabled, and select the correct interpreter for your project. If you use a virtual environment, verify that it exists and refresh environment discovery.
Once the interpreter path is correct, test it with sys.executable. This confirms exactly which Python installation is running your code and helps prevent package installation and environment mix-ups.
Official References
- Python environments in Visual Studio Code
- Python in Visual Studio Code
- VS Code Python settings reference
- Download Python from Python.org
