Skip to content

Instantly share code, notes, and snippets.

@mchiocca
Created February 24, 2017 21:59
Show Gist options
  • Save mchiocca/9e2157f7330c055d3e80866eafaf8246 to your computer and use it in GitHub Desktop.
Save mchiocca/9e2157f7330c055d3e80866eafaf8246 to your computer and use it in GitHub Desktop.
Install Python 2.7 on CentOS 6.8
#!/bin/bash
# Install external dependencies.
sudo yum install -y gcc make openssl-devel libffi-devel
# Download and install Python 2.7.5.
# Note that there are newer release versions available.
wget https://www.python.org/ftp/python/2.7.5/Python-2.7.5.tgz
tar xzf Python-2.7.5.tgz
cd Python-2.7.5
./configure --with-threads --enable-shared
sudo make altinstall
cd -
# Configure libraries.
# Resolves error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory.
sudo ln -s /usr/local/bin/python2.7 /usr/bin/python2.7
echo "/usr/local/lib/python2.7" > python27.conf
echo "/usr/local/lib" >> python27.conf
sudo chown root:root python27.conf
sudo chmod go-w python27.conf
sudo mv python27.conf /etc/ld.so.conf.d
sudo ldconfig
# Install pip, setuptools, and virtualenv.
wget https://bootstrap.pypa.io/get-pip.py && sudo -H python2.7 get-pip.py
sudo ln -s /usr/local/bin/pip /usr/bin/pip
sudo -H pip install virtualenv
# Install pyOpenSSL.
sudo yum install -y pyOpenSSL
sudo -H pip install pyOpenSSL ndg-httpsclient pyasn1 requests[security]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment