brew install pyenv pyenv-virtualenv pyenv-virtualenvwrapper
Install the prerequisites below for your operationg system and then run the following:
curl https://pyenv.run | bash
sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
xz-utils tk-dev libffi-dev liblzma-dev python3-openssl git
sudo yum install @development zlib-devel bzip2 bzip2-devel readline-devel sqlite \
sqlite-devel openssl-devel xz xz-devel libffi-devel findutils
#!/usr/bin/env bash
if command -v pyenv; then
py_version=$(pyenv install --list | \grep -vE "\-|rc" | \grep " 3\.[678]" | tail -n 1 | awk '{$1=$1};1')
pyenv install "$py_version"
pyenv global "$py_version"
echo "Installed Python $py_version"
else
echo "pyenv not installed"
echo "brew install pyenv pyenv-virtualenv"
exit 1
fi
pyenv virtualenv $py_version ansible
cd to the directory you want to active your virtualenv in.
cd ~/Projects/ansible
pyenv local ansible
This will create a file named .python-version
with your virtualenv ansible
in it.
You can start your virtualenv at anytime:
pyenv activate ansible
git clone https://github.com/mantoso/pyenv-default-requirements.git $(pyenv root)/plugins/pyenv-default-requirements
pyenv virtualenvs
Fork this repo https://github.com/tracphil/zsh-config