This short script creates a virtual environment for python if it does not exist yet. The second step is to activate the environment. The script must be executed via source ...
, even if the current shell has the command! Otherwise the virtual environment is not activated. As so often there is on stackoverflow the appropriate answer.
alias venv='source $HOME/.local/bin/python_venv.sh'
Afterwards the command can be executed in any directory where a virtual environment should exist.
$ venv