Just a quickie.

mikecase

Mike

Posted on May 27, 2022

Just a quickie.

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'
Enter fullscreen mode Exit fullscreen mode

These aliases create a virtualenv in /home/username/.config/venv/directoryname

${PWD##*/}
Enter fullscreen mode Exit fullscreen mode

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

💖 💪 🙅 🚩
mikecase
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.

Related

Just a quickie.
bash Just a quickie.

May 27, 2022