Created
January 28, 2019 13:55
-
-
Save yeraydiazdiaz/70fe3df091681f8bcd69a4f3d54230f1 to your computer and use it in GitHub Desktop.
Bash script to create a pyenv virtualenv in the current directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For virtual env example please