Skip to content

Instantly share code, notes, and snippets.

@hyamamoto
Created September 4, 2015 11:44
Show Gist options
  • Save hyamamoto/3127ef8ec06eb163c0c4 to your computer and use it in GitHub Desktop.
Save hyamamoto/3127ef8ec06eb163c0c4 to your computer and use it in GitHub Desktop.
This script installs `pyenv` to your home directory. (you can set PYENV_ROOT to change the directory, tho.)
#!/usr/bin/env bash
if [ ! $(which git) ]; then
echo "Git is not installed, can't continue."
exit 1
fi
if [ -z "${PYENV_ROOT}" ]; then
PYENV_ROOT="$HOME/.pyenv"
fi
# Install pyenv:
if [ ! -d "$PYENV_ROOT" ] ; then
git clone https://github.com/yyuu/pyenv.git $PYENV_ROOT
else
cd $PYENV_ROOT
if [ ! -d '.git' ]; then
git init
git remote add origin https://github.com/yyuu/pyenv.git
fi
git pull origin master
fi
# Show help if `.pyenv` is not in the path:
if [ ! $(which pyenv) ]; then
echo "
Seems you still have not added 'pyenv' to the load path:
# ~/.bash_profile:
export PYENV_ROOT=\"\${HOME}/.pyenv\"
if [ -d \"\${PYENV_ROOT}\" ]; then
export PATH=\"\${PYENV_ROOT}/bin:\${PATH}\"
eval \"\$(pyenv init -)\"
fi
"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment