Skip to content

Instantly share code, notes, and snippets.

@gma
Created October 19, 2019 12:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save gma/87bdd2319cd1ae5f493812a2c7f0384a to your computer and use it in GitHub Desktop.
Save gma/87bdd2319cd1ae5f493812a2c7f0384a to your computer and use it in GitHub Desktop.
function for making Python 3 virtual env
mkvenv()
{
local prompt="${1:-$(basename $(pwd))}"
shift
command -v deactivate >/dev/null && deactivate
[ -d .venv ] && echo "ERROR: .venv exists" 1>&2 && return 1
python3 -m venv .venv --prompt "\[\033[1;34m\]$prompt\[\033[0m\]" $*
activate
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment