-
-
Save prrao87/87b3761d58b7ae33c6250795a81d589d to your computer and use it in GitHub Desktop.
Command to activate / create Python virtual environmment
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
# Do not use the alias `python3` | |
# For this to work properly, explicitly specify the python version as necessary on your system | |
function venv { | |
default_envdir=".venv" | |
envdir=${1:-$default_envdir} | |
if [ ! -d $envdir ]; then | |
python3.12 -m venv $envdir | |
python3.12 -m pip install ruff | |
echo -e "\x1b[38;5;2m✔ Created virtualenv $envdir\x1b[0m" | |
fi | |
source $envdir/bin/activate | |
export PYTHONPATH=`pwd` | |
echo -e "\x1b[38;5;2m✔ Activated virtualenv $envdir\x1b[0m" | |
python3.12 --version | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment