Skip to content

Instantly share code, notes, and snippets.

@james-ni
Created November 24, 2020 12:04
Show Gist options
  • Save james-ni/1203b790d47164ca26470b23475ae18e to your computer and use it in GitHub Desktop.
Save james-ni/1203b790d47164ca26470b23475ae18e to your computer and use it in GitHub Desktop.
function pyvenv_enable () {
ENV_NAME=$(basename $PWD)
VENV_DIR="${HOME}/.venv/${ENV_NAME}"
if [ ! -d "${VENV_DIR}" ]; then
python3 -m venv ${VENV_DIR}
echo "Created venv: ${VENV_DIR}"
source ${VENV_DIR}/bin/activate
pip3 install --upgrade pip setuptools-scm
else
source ${VENV_DIR}/bin/activate
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment