Mike
Posted on May 27, 2022
Here are the aliases that I use for python virtual environments.
# aliases for venv (python-venv)
alias create-venv='python3 -m venv /home/${USER}/.config/venv/${PWD##*/}'
alias remove-venv='rm -rf /home/${USER}/.config/venv/${PWD##*/}'
alias activate-venv='source /home/${USER}/.config/venv/${PWD##*/}/bin/activate'
These aliases create a virtualenv in /home/username/.config/venv/directoryname
${PWD##*/}
Gets only the directory name your currently in, not the full path.
I.E. the full path '/home/username/code/python/app_name' ${PWD##*/} returns only app_name
💖 💪 🙅 🚩
Mike
Posted on May 27, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.