Free tools Windows power users keep installed
One-click scans. No signup required.
VS Code can show one Python interpreter for language features while an integrated terminal or debug session uses another. Check the workspace’s selected interpreter, then verify the terminal’s actual executable in a newly opened shell. If only imports or debugging disagree, investigate Pylance’s search paths or the active launch.json configuration.
Why VS Code can use different Python interpreters
VS Code’s selected environment is the baseline for running code, debugging, and language features such as IntelliSense. You can see the selection in the status bar or change it with Python: Select Interpreter. However, a terminal is a separate shell process, and a debug configuration can explicitly override the interpreter. That is why one selection does not necessarily change every already-open terminal or custom debug session. Microsoft’s Python environments documentation describes the selected environment’s role; its debugging documentation covers the override.
As an Amazon Associate I earn from qualifying purchases.
For a quick diagnosis, compare these contexts rather than repeatedly changing settings:
- The interpreter selected for the workspace.
- The Python executable the terminal resolves when you run
python. - The environment and paths Pylance uses to resolve imports.
- The interpreter specified by the active debugger configuration, if any.
1. Confirm the workspace interpreter
- Look at the Python interpreter shown in the VS Code status bar, or open the Command Palette and run Python: Select Interpreter.
- Choose the environment intended for this project. If the project has a local
.venvorvenv, check that entry before choosing a global or system Python. - If the intended environment is missing, check whether its location is covered by the configured environment search paths, or whether the environment needs repair or recreation.
When no interpreter has been selected explicitly, VS Code’s documented auto-selection order gives workspace-local .venv and venv environments higher priority than global or system interpreters. See Python environments in VS Code for selection and discovery details.
#1 Best Overall
2. Check the terminal’s Python separately
An integrated terminal runs a shell. Its active environment depends on shell state and VS Code’s terminal activation configuration; an existing shell can retain the environment it started with. After selecting an interpreter or changing activation settings, open a new terminal and check what executable it actually uses.
- Create a fresh integrated terminal in VS Code.
- Check the Python version and executable resolution. On many macOS or Linux shells, use
which pythonandpython --version. On Windows, usewhere pythonandpython --version. - Compare the reported executable with the environment selected in VS Code. If they differ, activate the intended environment in the shell or use the environment-specific terminal workflow.
The current Python settings reference describes python-envs.terminal.autoActivationType, whose values are command, shellStartup, and off. If configured, this newer setting takes precedence over the older python.terminal.activateEnvironment setting, whose documented default is true. Review the effective activation setting and restart the terminal after changing it. See the Python settings reference and environment documentation.
Rank #2
3. Resolve Pylance import errors
Pylance is VS Code’s default Python language server and provides IntelliSense. If it marks an import as missing even though your code runs, first check whether Pylance’s selected environment is the same one where the package is installed. An installed package in a different interpreter will not necessarily be visible to the environment Pylance is analyzing. Microsoft’s Python editing documentation explains interpreter-based import resolution.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problems- Confirm the selected interpreter in the status bar or with Python: Select Interpreter.
- In a terminal verified to use that interpreter, install the missing dependency with
python -m pip install <package>, replacing<package>with the package name. - If the module is genuinely stored outside standard locations, configure
python.analysis.extraPathsfor that location rather than installing the package again.
Using python -m pip ties the installer invocation to the Python executable resolved by that terminal. Verify the executable first; otherwise, the package could still be installed into the wrong environment.
4. Inspect the debugger only if debug runs differ
The debugger uses the selected interpreter by default, but a python property in the active workspace’s launch.json can specify a different executable. If the terminal and IntelliSense agree but a debug run uses another Python, inspect the active debug configuration and its interpreter path instead of changing Pylance settings. See Python debugging in VS Code.
Match the symptom to the likely cause
| Symptom | Likely cause | What to check |
|---|---|---|
| Pylance flags an installed package as missing | The package is installed in another environment, or its location is non-standard. | Select the environment containing the package; use python.analysis.extraPaths only for a genuine non-standard location. Source. |
| A new terminal uses system Python | Automatic activation may be off or configured differently than expected. | Review python-envs.terminal.autoActivationType and restart the terminal. Source. |
| An existing terminal stays on the old environment | The shell has not been recreated or manually reactivated. | Open a fresh terminal and verify its executable. Source. |
| Only debug runs use another Python | The active launch.json may set a separate interpreter. |
Inspect the python property in the active debug configuration. Source. |
| The intended environment is absent from the interpreter list | Its location may be outside discovery paths, or the environment may be broken. | Check the relevant environment search paths or repair or recreate the environment. Source. |
Fast check: find which context is out of alignment
- Wrong language features or missing imports: confirm the selected interpreter and where the package is installed; then check whether
python.analysis.extraPathsapplies. - Wrong Python in the terminal: inspect the shell’s executable and activation setting, then create a fresh terminal.
- Wrong Python only while debugging: check for a
pythonoverride in the activelaunch.json.
For a broader overview of interpreter selection and running Python in VS Code, see Python in Visual Studio Code.
Quick Recap
Best Value
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




