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?
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.
File > Preferences > Settings > User tab > Extensions > python > Python Path
type your python path e.g.: c:\python35\python.exe
pipenv
) code.visualstudio.com/docs/python/…
Jan 26, 2022 at 11:53
press ctrl+shift+p to launch command pallete and
type python interpreter and you will get an option select interpreter
then select python interpreter
Choosing an environment By default, the Python extension relies on the first Python interpreter it finds in the path, but it's easy to switch between environments.
To use a specific interpreter, select the Python: Select Interpreter command from the Command Palette (Ctrl+Shift+P).