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 https://marketplace.visualstudio.com/items?itemName=donjayamanne.python.
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\python.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?
Select and activate an environment# To select a specific environment, use the Python: Select Interpreter command from the Command Palette (Ctrl+Shift+P). Note: If the Python extension doesn't find an interpreter, it issues a warning.
Click on the Extension button on the left-hand menu bar. The Marketplace for VS Code Extensions should open up. Search for python in the search bar. Choose the Python extension provided by Microsoft and click on “Install”.
Install Python and the Python extension# Once you have a version of Python installed, activate it using the Python: Select Interpreter command. If VS Code doesn't automatically locate the interpreter you're looking for, refer to Environments - Manually specify an interpreter.
Select the Add Environment command in the Python Environments window or the Python toolbar, select the Python installation tab, indicate which interpreters to install, and select Install. You can also manually install any of the interpreters listed in the table below outside of the Visual Studio installer.
macOS
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"
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 paletteUpon 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.
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
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With