Skip to content

Instantly share code, notes, and snippets.

@marcoemorais
Created June 17, 2014 23:07
Show Gist options
  • Save marcoemorais/7f36ae85abf93d2d77a8 to your computer and use it in GitHub Desktop.
Save marcoemorais/7f36ae85abf93d2d77a8 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# execute (python|pip|virtualenv) as 'env PATH=${PREFIX}:${PATH} python'
PREFIX=/opt/mypy
if [ $# -gt 0 ] ; then
PREFIX=$1
fi
PYVER=2.7.6
if [ $# -gt 1 ] ; then
PYVER=$2
fi
sudo yum install -y wget
sudo yum install -y zlib-devel openssl-devel ncurses-devel bzip2 bzip2-libs bzip2-devel
sudo mkdir -p ${PREFIX}
sudo chmod 777 ${PREFIX}
PYURL="http://www.python.org/ftp/python/${PYVER}/Python-${PYVER}.tgz"
PYPKG=`basename ${PYURL}`
PYDIR=`basename ${PYPKG} .tgz`
if [ ! -f ${PYDIR} ] ; then
wget --no-check-certificate ${PYURL}
tar -xvf ${PYPKG}
cd ${PYDIR}
./configure --prefix=${PREFIX}
make
make install
cd ..
fi
PYPATH="env PATH=${PREFIX}/bin:${PATH}"
EZSETUPDIR="ez_setup"
if [ ! -f ${EZSETUPDIR} ] ; then
mkdir -p ${EZSETUPDIR}
fi
wget https://bootstrap.pypa.io/ez_setup.py --output-document ${EZSETUPDIR}/ez_setup.py
${PYPATH} python ${EZSETUPDIR}/ez_setup.py install
${PYPATH} easy_install pip
${PYPATH} pip install virtualenv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment