Skip to content

Instantly share code, notes, and snippets.

@savsgio
Last active March 18, 2021 13:01
Show Gist options
  • Save savsgio/5be2c6d793554933a32a18dcbb1affa0 to your computer and use it in GitHub Desktop.
Save savsgio/5be2c6d793554933a32a18dcbb1affa0 to your computer and use it in GitHub Desktop.
Auto-activate python virtualenv in VSCode Integrated Terminal
## File: ~/.bashrc
## Your virtualenv is in /home/.virtualenvs/
# Auto-activate python virtualenv
if [ ! -z $PYTHONVIRTUALENV ]; then
source /home/.virtualenvs/$PYTHONVIRTUALENV/bin/activate
fi
## File: .vscode/settings.json
{
"terminal.integrated.env.linux": {
"PYTHONVIRTUALENV": "<name of virtualenv>"
}
}
@metajiji
Copy link

metajiji commented Sep 29, 2019

- if [ ! -z $PYTHONVIRTUALENV ]; then
+ if [ -n "$PYTHONVIRTUALENV" ]; then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment