Created
April 21, 2024 16:28
-
-
Save mcking-07/0220649ee75d025fa457c1a7bb76096b to your computer and use it in GitHub Desktop.
python env manager
This file contains hidden or 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
pload() { | |
local ENV_DIR=".pyenv" | |
local SCRIPT_PATH="$ENV_DIR/bin/activate" | |
if [ -d "$ENV_DIR" ] && [ -f "$SCRIPT_PATH" ]; then | |
source "$SCRIPT_PATH" | |
else | |
read -p "environment not found. create one? (Y|n) " choice | |
case $choice in | |
Y|y|"") | |
python3 -m venv "$ENV_DIR" && source "$SCRIPT_PATH" || echo "environment setup failed." ;; | |
N|n) | |
echo "cancelled!" ;; | |
*) | |
echo "unrecognized option." ;; | |
esac | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment