Skip to content

Instantly share code, notes, and snippets.

@Crowles
Last active August 26, 2016 09:01
Show Gist options
  • Save Crowles/40039a60f4681ed1052d232fe96ac6c4 to your computer and use it in GitHub Desktop.
Save Crowles/40039a60f4681ed1052d232fe96ac6c4 to your computer and use it in GitHub Desktop.
Install Python 3.3 without breaking yum (RHEL / CentOS)
#!/bin/bash
echo "updating packages"
yum -y update
echo "install YUM development tools"
yum groupinstall -y development
echo "installing additional packages"
yum install -y zlib-dev openssl-devel sqlite-devel bzip2-devel
echo "downloading source archive"
wget http://www.python.org/ftp/python/3.3.3/Python-3.3.3.tar.xz
echo "source archive is compressed using XZ library"
echo "installing XZ libs"
yum install -y xz-libs
echo "decoding XZ archive"
xz -d Python-3.3.3.tar.xz
echo "extracting archive"
tar -xvf Python-3.3.3.tar
# Enter the extracted directory
cd Python-3.3.3
echo "configuring Python 3.3.3"
# set installation directory
./configure --prefix=/usr/local
echo "compiling source"
# Using make altinstall so system default python isn't overridden (which would break yum)
make
make altinstall
# access python without explicitly defining path
export PATH="/usr/local/bin:$PATH"
echo "install pip dependencies"
wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-1.4.2.tar.gz
tar -xvf setuptools-1.4.2.tar.gz
# Enter the extracted directory:
cd setuptools-1.4.2
# Install setuptools using Python 3.3
python3.3 setup.py install
echo "installing pip"
# pip python 3.3
curl https://bootstrap.pypa.io/get-pip.py | python3.3 -
echo "installing virtualenv"
# used to create isolated python environments
pip install virtualenv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment