vscode-python: The Python path in your debug configuration is invalid.
Environment data
- VS Code version: 1.45.1
- Extension version (available under the Extensions sidebar):2020.5.80290
- OS and version: win10
- Python version (& distribution if applicable, e.g. Anaconda): python-3.8.3-embed-amd64
- Type of virtual environment used (N/A | venv | virtualenv | conda | …): N/A
Expected behaviour
vscode can find python interpreter
Actual behaviour
vscode cann’t found python interpreter
Steps to reproduce:
-
download python-3.8.3-embed-amd64.zip and Unzip it
-
write sample python code and use vscode opened it:
print(123)
- create launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: cureent file",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"pythonPath": "e:/tools/re/python-3.8.3-embed-amd64/python.exe"
},
]
}
- press f5 to debug it
- message fatal:
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 9
- Comments: 15 (2 by maintainers)
Follow The Microsoft guide to solve your problem.
https://code.visualstudio.com/docs/python/environments > “To select a specific environment, use the Python: Select Interpreter command from the Command Palette (Ctrl+Shift+P).”
I had wrong path to python interpreter in the user settings. When manually setting the path to the interpreter via the gui, to be used inside the dev container, it silently failed. I found it in the Python log output eventually. A popup for this error would have been very helpful 😅
@scalavision Can you share your debug configuration? Normally you don’t have to set the pythonPath in the debug configuration, unless you want to run your code using a different python.
you can also use “python” to set a custom python path (default uses the selected python path):
Finally fixed the problem by uninstalling VSCode and reinstalling it. Now it can find the python interpreter.
The best and the easiest solution. Thank you! 😃
I was able to fix this by adding
python.pythonPath
to my devcontainer.json:Running with the isolated script seems to cause the interpreterInfo script to fail in this scenario: