I have:
- two conda environments,
myenv1
andmyenv2
; - two folders containing
.py
files:folder1
andfolder2
.
Let's say I've been working on folder1
in VS Code using myenv1
, and then I do the following:
- I close
folder1
(usingFile -> Close Folder
) - I open
folder2
(usingFile -> Open Folder...
). - I switch to
env2
using thePython: Select Interpreter
command.
What happens?
- The blue information bar at the bottom of the VS Code window says "Python 3.8.2 64-bit ('env2': conda)" -- this suggests to me I'm now working in
env2
. - But I don't think the VS Code has correctly switched to
env2
. Why? Because if I attempt to import a package that exists inenv2
but notenv1
I get an error. If I import a package that exists inenv1
but notenv2
the import is successful.
But if I close VS Code and open it again (without doing anything else), the switch to env2
has been successful (by performing the same import test).
Is this a known bug, or am I doing something wrong? I've tried to find the issue on github without success.
Many thanks for your help.
Frank.
PS: I guess I could manually set sys.executable
but I'd like to use the VS Code functionality if possible.