For the Python environment, visit pyenv. The assumption is an OS X environment. Install readline
with Homebrew in advance.
CWD=$(pwd)
PYENV="${HOME}/.pyenv"
PYVER='3.5.0'
if ! which pyenv &> /dev/null
then
[ ! -d ${PYENV} ] && git clone git://github.com/yyuu/pyenv.git ${PYENV}
export PATH="${PYENV}/bin:${PATH}"
eval "$(pyenv init -)"
else
cd ${PYENV}
git pull
cd ${CWD}
fi
if ! pyenv versions | grep ${PYVER} &> /dev/null
then
CFLAGS="-I$(brew --prefix readline)/include" \
LDFLAGS="-L$(brew --prefix readline)/lib" \
pyenv install ${PYVER}
fi
pyenv global ${PYVER}
pyenv rehash
unset PYENV PYVER
if which pip &> /dev/null
then
PIPS=(
'ansible'
'awscli'
'fabric'
'flake8'
)
for PIP in "${PIPS[@]}"
do
pip install --upgrade ${PIP}
done
pyenv rehash
unset PIPS PIP
fi
unset CWD
After installation, add the following line to $ {HOME} /. Bash_profile
:
export PATH="${HOME}/.pyenv/bin:${PATH}"
eval "$(pyenv init -)"
[ -f "${HOME}/.pyenv/completions/pyenv.bash" ] && source "${HOME}/.pyenv/completions/pyenv.bash"
Recommended Posts