Skip to content

Instantly share code, notes, and snippets.

@abepark01
Last active December 24, 2016 20:43
Show Gist options
  • Save abepark01/4e6ef056e2c6ae691f2af3ce72a106b4 to your computer and use it in GitHub Desktop.
Save abepark01/4e6ef056e2c6ae691f2af3ce72a106b4 to your computer and use it in GitHub Desktop.
Downloads and builds Python 3.5.2 locally
#### Description: downloads and installs python 3.5.2 locally
PYTHON_VERSION=3.5.2
PREFIX=$HOME/.local
WORK_DIR=$HOME/src
TMP_DIR=$HOME/tmp/python
LD_RUN_PATH=$PREFIX/lib
SRC_DIR=$WORK_DIR/Python-${PYTHON_VERSION}
# Setup folders
mkdir -p $PREFIX
mkdir -p $WORK_DIR
mkdir -p $TMP_DIR
# Download the source files
if [ ! -d ${SRC_DIR} ]
then
cd $WORK_DIR
wget -q https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz
tar xvf Python-${PYTHON_VERSION}.tgz
fi
# Build
cd $TMP_DIR
${SRC_DIR}/configure \
--enable-shared \
--prefix=${PREFIX} \
LDFLAGS="-W1, -rpath ${LD_RUN_PATH}"
make
make install
# Cleanup
if [ ! -z "$TMP_DIR"]
then
rm -fr $TMP_DIR
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment