I'm trying to switch to VS Code for my Python learning / development. Still finding my way around.
I suspect this is a "duh" problem, but I'm having trouble with environments. I can select an env in the Terminal with .venv/Scripts/Activate.ps1
(is that the right way to do it?), so I can pip-install modules in the environment. But the code I run in my notebook (using the "Jupyter" & related extensions) doesn't use that env. I can't import the installed modules, because my notebook is using some other env.
I tried Python: Select Interpreter
and it's using .venv/Scripts/python.exe
but that doesn't seem to change the Jupyter env.
VS has a command to create an env, but I see no way to select the env that the code runs in. Or tell what environment the notebook is running in. VS doesn't seem to pay attention to the .venv
dir in my workspace directory, even if I start VS by running code
in that dir.
I've googled all over and I can't find an answer. Closest I've found is How can I set up a virtual environment for Python in Visual Studio Code? but I don't think that works for the Jupyter environment.