forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Labels
Milestone
Description
Refs: #22121
- windows @joyceerhl
- linux @sbatten
- macOS @aiday-mar
Complexity: 5
Requirements
- Python extension pre-release & VS Code Insiders
- Basic terminal shell types, please install if necessary and tick once tested:
- Windows:
- cmd
- powershell
- powershellcore
- Linux (our codespaces already have these installed):
- bash
- zsh
- fish
- macOS :
- bash
- zsh
- powershellcore
- Windows:
Background
Traditionally, activation script (<venv>/<bin>/activate) was run to activate terminals, which registered the deactivate command as well. But now that we're using environment variables to activate terminals instead, deactivate command is broken as it never gets registered.
To make it work, this we added a notification system which helps user register the "deactivate" command in their shell init script.
Verification
- Add following to user settings and reload window:
"python.experiments.optInto": ["pythonTerminalEnvVarActivation"]
-
Open a workspace folder and activate Python extension by opening a Python file.
-
Use
Create environmentcommand to select a venv -
Loop -> Do the following for all terminal shell types:
- Open a new terminal.
- Make sure terminal is activated using the selected environment. Run the following in terminal:
python -c"import sys;print(sys.executable)" - Output should contain the path to interpreter selected. For eg. for
.venvit looks something like:C:\Users\karraj\OneDrive - Microsoft\Desktop\folders\crap\.venv\Scripts\python.exe - Run "deactivate" command in terminal, a similar notification should show up:

- Verify clicking "learn more" points to appropriate wiki.
- After following through with the notification, ensure deactivate command works:

- Change the default shell in your OS using
Terminal: Select Default Profile, saybash->fish