Last active
March 24, 2020 16:15
-
-
Save tcgarvin/5ace90ca0fe81ffddb2e4657c341fece to your computer and use it in GitHub Desktop.
Bash function to deactivate the current virtual environment and activate the one in the present directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Bash function to deactivate the current virtual environment and activate the one in the present directory | |
venv () { | |
if [ -f "venv/bin/activate" ]; then | |
if [ "`type -t deactivate`" = "function" ]; then | |
echo "Deactivating venv in anticipation of a new one" | |
deactivate | |
fi | |
echo "Activating venv at `pwd`" | |
source venv/bin/activate | |
else | |
echo "No venv found at `pwd`" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment