The small problem is, when I press Ctrl+F5, I want the code to be run immediately; but I have to
Select environment: Python Python Exprimental
all the time. Is there a way to set default env in settings so I don't have to choose at each run?
vscode deprecated the python.pythonPath setting.
Since the 2021.6.0 (16 June 2021) update we should use
Windows:
{
"python.defaultInterpreterPath": "c:/dev/ala/venv/Scripts/python.exe"
}
macOS/Linux:
{
"python.defaultInterpreterPath": "/home/abc/dev/ala/venv/bin/python"
}
The vscode documentation has already been updated. https://code.visualstudio.com/docs/python/environments#_manually-specify-an-interpreter
Once you selected an interpreter, it should be stored in the settings.json file in .vscode folder. It should be something like this:
{
"python.pythonPath": "C:\\Users\\Username\\AppData\\Local\\Programs\\Python\\Python36\\python.exe"
}
Next time you use vscode to open this folder, the python interpreter you used last time should be automatically selected.
Maybe you didn't use "Open folder" to open the working directory. And then vscode will try to read the local .vscode folder if any, otherwise it will follow a certain path order to select an interpreter. Hope that helps.
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