## Manage python
function install_pyenv {
echo "# Pyme ~ Installing pyenv ..."
if which curl | grep -q curl ; then
if which pyenv | grep -q pyenv ; then
echo "# Pyenv found !"
else
echo "# Bootstrapping..."
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
fi
fi
}
function install_python {
echo "# Pyme ~ Installing python $1..."
if pyenv versions | grep -q $1 ; then
echo "# Version exists already"
else
pyenv install $1
fi
theEnv=`pyenv which python | grep $1`
echo "# Pyme ~ Python lives at : $theEnv"
export PATHZ="$PATH:`dirname $theEnv`";
echo "#"
echo "#"
echo "export PATH=$PATHZ"
echo "#"
echo "#"
}
install_pyenv
install_python $1
TO RUN IT ...
cat << EOF > pyme.sh
## Manage python
function install_pyenv {
echo "# Pyme ~ Installing pyenv ..."
if which curl | grep -q curl ; then
if which pyenv | grep -q pyenv ; then
echo "# Pyenv found !"
else
echo "# Bootstrapping..."
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
fi
fi
}
function install_python {
echo "# Pyme ~ Installing python $1..."
if pyenv versions | grep -q $1 ; then
echo "# Version exists already"
else
pyenv install $1
fi
theEnv=`pyenv which python | grep $1`
echo "# Pyme ~ Python lives at : $theEnv"
export PATHZ="$PATH:`dirname $theEnv`";
echo "#"
echo "#"
echo "export PATH=$PATHZ"
echo "#"
echo "#"
}
install_pyenv
install_python $1
EOFchmod 777 pyme.sh
./pyme.sh 3.3.0
eval $(./pyme.sh 3.3.0)
it works !
python 3.3.0
And, there you go, your python is the one you want.
Only tested on OS X, If i get around to it, I'll test it in linux in some vagrant boxes and update as needed.
No comments:
Post a Comment