Summary
!! You need root privileges to follow this guide. !!
You can install Python 2.7 on CentOS 6, but you have to use "make altinstall" instead of "make install" and modify the first line of /usr/bin/yum, to make sure yum work after installation.
You can install Python 2.7 on CentOS 6, but you have to use "make altinstall" instead of "make install" and modify the first line of /usr/bin/yum, to make sure yum work after installation.
Steps:
1. Install dependencies
2. Build/Install python
3. Fix some issues
Instruction
####
# CentOS 6.4, 6.5 Python 2.7 Installation Steps
# issue: some obsolete packages (bsddb185 dl imageop sunaudiodev) cannot be built
####
# Let's be the root user
su
# Dependency
yum groupinstall -y 'Development Tools'
yum install -y bzip2-devel db4-devel gdbm-devel libpcap-devel ncurses-devel openssl-devel readline-devel sqlite-devel tk-devel xz-devel xz-libs zlib-devel wget curl
# Compile Python & Do Alternative-Install
NEW_VER=2.7.10
cd /usr/local/src
wget --no-check-certificate -N http://www.python.org/ftp/python/$NEW_VER/Python-$NEW_VER.tgz
tar xzf Python-$NEW_VER.tgz
cd Python-$NEW_VER
./configure --enable-shared --with-pic
make
make altinstall
# pip, setuptools, wheel
curl https://raw.githubusercontent.com/pypa/pip/master/contrib/get-pip.py | python2.7 -
# Library Linking Path
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib; export LD_LIBRARY_PATH;" > /etc/profile.d/python27.sh
### then let's fix side-effects
# fix /usr/bin/yum by modifying /usr/bin/python to /usr/bin/python2.6
vim /usr/bin/yum
# backup /usr/bin/python
cp /usr/bin/python /usr/bin/python_old
# replace /usr/bin/python
cp /usr/local/bin/python2.7 /usr/bin/python
# reboot
sync; reboot
# install modules as needed
pip install numpy
pip install scipy
pip install theano
#pip install pycuda
#pip install pylearn
#pip install scikit-learn