Feb-14-2023, 08:00 PM
Quote:Is there any possibility to enable VS Code to recognize which interpreter/virtual environment has to be used? (e.g. when selecting a *.py in a respective folder)Kind of. When you open a folder in VSCode, that folder is treated as the top of the project. You can then specify the Python interpreter to use with that project.
Inside the same source tree you can open a different folder and set a different Python interpreter. Depending on what folder you "open", in VSCode, you get a different interpreter.
For example, I have a mucking about folder I call "musings". Under musing I have a "pygames" folder and a "qt" folder. I have a virtual environment that I use for the musings folder that ends up being a catch-all that I blast from time to time and restart. The pygames folder has it's own virtual environment that has a bunch of pygame packages installed. qt has a different virtual environment that has qt related packages installed.
So you cannot bind an interpreter to a particular python file, but you can bind an interpreter to a particular folder.