Closed
Description
Refs: #21101
- windows @amunger
- linux @lramos15
- macOS @aiday-mar
Complexity: 5
Requirements
Similar to #20884 hence preassigning. Make sure to check the (new) requirements.
- Python extension pre-release
- Latest VSCode Insiders
- Virtual or conda environment
- Install conda via: https://conda.io/projects/conda/en/latest/user-guide/install/index.html. Make sure it's on
PATH
during installation.- Run
conda init
to initialize the shell. - (new) Run
conda config --set auto_activate_base False
. - Restart shell for changes to take effect.
- Create conda env using
conda create -n <name> python -y
.
- Run
- Use
python -m venv <name>
to create virtual envs.
- Install conda via: https://conda.io/projects/conda/en/latest/user-guide/install/index.html. Make sure it's on
Verification
- Add following to user settings and reload window:
"python.experiments.optInto": ["pythonTerminalEnvVarActivation"]
-
Use a workspace with multiple workspace folders. (
File -> Add folder to workspace...
) -
For each workspace folder:
- Activate Python extension by opening a Python file.
- Select a virtual or conda environment using
Python: Select Interpreter
command. This should be different for each folder.
-
For each workspace folder,
w
:- Make sure terminal for
w
is activated using the selected environment forw
. Run the following in terminal:python -c"import sys;print(sys.executable)"
- Output should contain the path to interpreter selected. For eg. for
.venv
created viapython -m venv .venv
it looks something like:C:\Users\karraj\OneDrive - Microsoft\Desktop\folders\crap\.venv\Scripts\python.exe
- Hover over the tab title, note
Python
has a description for which env is activated next to it:
- Run some random commands in the terminal, then change environment using
Python: Select Interpreter
command, a warning sign should appear to the right of terminal with new env changes that're about to be made:
- Make sure terminal for