目次

CentOS6にPython2.7

https://www.python.org/

現状の確認

# cat /etc/redhat-release                                   
CentOS release 6.7 (Final)

# uname -a
Linux localhost.localdomain 2.6.32-573.el6.x86_64 #1 SMP Thu Jul 23 15:44:03 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
# which python
/usr/bin/python

# python -V
Python 2.6.6

事前準備

# yum groupinstall 'Development Tools'
# yum install zlib-devel
# yum install openssl-devel

Install

# curl -O https://www.python.org/ftp/python/2.7.11/Python-2.7.11.tgz
# tar zxf Python-2.7.11.tgz
# cd Python-2.7.11
# ./configure --prefix=/usr/local
# make && make altinstall

# which python2.7
/usr/local/bin/python2.7

# python2.7 -V
Python 2.7.11

pip

# curl -kL https://bootstrap.pypa.io/get-pip.py | python2.7

# which pip2.7
/usr/local/bin/pip2.7

# pip2.7 -V                                                 
pip 8.1.1 from /usr/local/lib/python2.7/site-packages (python 2.7)