Skip to content

Instantly share code, notes, and snippets.

@mihaidusmanu
Last active December 19, 2022 12:53
Show Gist options
  • Save mihaidusmanu/826b7dc83454f07520f51176ad2ad952 to your computer and use it in GitHub Desktop.
Save mihaidusmanu/826b7dc83454f07520f51176ad2ad952 to your computer and use it in GitHub Desktop.
# python venv
VENV_PATH=/home/dusmanum/.venvs
function create_venv () {
if [[ $# -ne 1 ]]; then
echo "Error: Expected env name as parameter"
return
fi
echo "Creating env $1 in $VENV_PATH/$1"
python -m venv $VENV_PATH/$1
}
function activate_venv () {
if [[ $# -ne 1 ]]; then
echo "Error: Expected env name as parameter"
return
fi
echo "Activating env $1 from $VENV_PATH/$1"
source $VENV_PATH/$1/bin/activate
}
function delete_venv () {
if [[ $# -ne 1 ]]; then
echo "Error: Expected env name as parameter"
return
fi
echo "Deleting env $1 from $VENV_PATH/$1"
rm -r $VENV_PATH/$1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment