Last active
September 9, 2022 08:59
-
-
Save danielk333/588c1b9b07cdfefc8d7af7f2d885a051 to your computer and use it in GitHub Desktop.
HPC-venvs
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
activate () { | |
source ~/projects/$1/.venv/bin/activate | |
} | |
venv () { | |
if [ -z $1 ] | |
then | |
echo "No project name given, exiting" | |
return | |
fi | |
target_venv=~/projects/$1/.venv | |
if [ ! -d "~/projects/$1" ] | |
then | |
echo "Project does not exist, exiting" | |
return | |
fi | |
echo "New venv target=$target_venv" | |
if [ -d "$target_venv" ] | |
then | |
echo "Folder '$1' already has a virtual enviornment, exiting" | |
else | |
python -m venv --upgrade-deps --system-site-packages $target_venv | |
echo "Created virtualenv $venv_target" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment