Skip to content

Instantly share code, notes, and snippets.

@yeraydiazdiaz
Created January 28, 2019 13:55
Show Gist options
  • Save yeraydiazdiaz/70fe3df091681f8bcd69a4f3d54230f1 to your computer and use it in GitHub Desktop.
Save yeraydiazdiaz/70fe3df091681f8bcd69a4f3d54230f1 to your computer and use it in GitHub Desktop.
Bash script to create a pyenv virtualenv in the current directory
#!/bin/bash
set -e
if [ -n "$1" ]; then
PYTHON_VERSION=$1
else
echo "Please specify a Python version, e.g. 3.7.1";
exit 1
fi
set +e
BASE_PATH=$(basename `pwd`)
pyenv local $1 && \
python --version && \
python -m venv .venv && \
ln -s `pwd`/.venv ~/.pyenv/versions/$BASE_PATH && \
pyenv local $BASE_PATH
echo "Python virtual env created successfully"
@md-fahad-ali32
Copy link

For virtual env example please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment