in Windows 10, How to configure Visual Studio Code to find the Python 3 interpreter?

Each Answer to this Q is separated by one/two green lines.

In Windows 10, How Visual Studio Code should be configured to find the Python 3 interpreter?

Visual Studio Code is not able to find the Python 3 interpreter.

I have added the Python extension, the Python extension at

How settings.js should be changed to use Python?

Even if python.pythonPath in settings.js is changed to be led to python.exe, which is at “C:\Users<User>\AppData\Local\Programs\Python\Python36-32\p?ython.exe”, if I select Python: Select Workspace Interpreter in the command palette, I get the message Please open a workspace to select the Python Interpreter. Why is this happening?


VSCode -> Preferences -> Settings -> scroll down to Python Configuration.

Click the pencil on the left of the configuration you’d like to use and click Copy Settings.

"python.pythonPath": "python3.6"

enter image description here

enter image description here

Go to File/Preferences/Settings and find Python Configuration. This is where you manually change the configurations.

You can also select your interpreter from command palette. The following instructions are from DonJayamanne’s Github.

Select the command Python: Select Workspace Interpreter from the command palette

Upon selecting the above command a list of discovered interpreters will be displayed in a quick pick list

Selecting an interpreter from this list will update the settings.json file automatically.

Command Pallet Screenshot

In the current directory where you open you VS Code, go to .vscode/settings.json and modify this line in the json file:

    "python.pythonPath": "path_to_your_python_bin", 
    # e.g., /home/myname/venv/bin/python3.7 or to a .exe file if you are on Windows

I’m also using this Python extension in Visual Studio Code on Windows 10.
Python is installed in C:\Python27\ and C:\Python36\ and both folders are added to the Windows PATH variable
With this setting VS Code should be able to find the Python interpreter. At least in my environment it worked well.

But VS takes the first interpreter it can find, which was in my case the Version 3.6. When I need 2.7 for a project I have to tell VS Code explicitely to use that one in the configration file settings.json
In VS Code press Ctrl, and then, in the right window add:

"python.pythonPath": "c:/python27/python.exe"

or whatever is the path to the Python interpreter on your PC.

This is also described in the Wiki under Manual Configuration.
Now, with this setting Python 2.7 was used.

Something that did not work was that the automatic detection of the Python versions and therefore I could also not choose the version I need with the Select an Interpreter command.

The Please open a workspace to select the Python Interpreter. error is simple.
I believe you’ve opened a VS Code window without selecting any folder.
As such, no workspace was opened, and workspace-specific settings cannot be set.

If you wish to set a default python interpreter for all workspaces, open settings with Ctrl+Shift+P, Preferences: Open User Settings and search for Python: Default Interpreter Path. Otherwise, if you want to set it for only the current workspace, use Preferences: Open Workspace Settings.

VS code settings for default python interpreter

In your case, you wish to set it to C:\Users<User>\AppData\Local\Programs\Python\Python36-32\p?ython.exe. Though I would suggest using a virtual environment. If you edit settings.json directly instead of using the GUI:

  "python.defaultInterpreterPath": "C:\Users<User>\AppData\Local\Programs\Python\Python36-32\p?ython.exe"

Detailed instructions can be found in the documentation “Manually specify an interpreter”, including using environment variables as the interpreter’s path.

Also, "python.pythonPath" has been deprecated. Therefore most other answers are outdated:

2021.6.0 (16 June 2021)
5. Added python.defaultInterpreterPath setting at workspace level when in pythonDeprecatePythonPath experiment. (#16485)
8. Show python.pythonPath deprecation prompt when in pythonDeprecatePythonPath experiment. (#16485)

2020.7.0 (16 July 2020)
9. Prompt users that we have deleted pythonPath from their workspace settings when in Deprecate PythonPath experiment. (#12533)

2020.5.0 (12 May 2020)
6. Do a one-off transfer of existing values for python.pythonPath setting to new Interpreter storage if in DeprecatePythonPath experiment. (#11052)
8. Added prompt asking users to delete python.pythonPath key from their workspace settings when in Deprecate PythonPath experiment. (#11108)
12. Rename string ${config:python.pythonPath} which is used in launch.json to refer to interpreter path set in settings, to ${config:python.interpreterPath}. (#11446)

2020.4.0 (20 April 2020)
13. Added a user setting python.defaultInterpreterPath to set up the default interpreter path when in Deprecate PythonPath experiment. (#11021)

I also had this problem. I did what @jps said and it still didn’t work, but then I changed my Environment Settings order so that Python36 precedes Python27, and it worked.

In my case I have seen the actual workspace you are working in override the File/Preferences/Settings (Windows) or Code/Preferences/Settings (Mac).

The solution was to manually edit the workspace file (usually in your home directory) or to create a new workspace and re-add your directory for your code.

Uninstall x64 version. and Install the x86 32bit version. Exclude python from AV. this should do the trick. The Python extension. Be Sure to restart the VSCode each time.

The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .