Install Python 2.7 on CentOS 6
CentOS 6 comes with python 2.6, to install python 2.7, first install gcc and dependencies yum
1 2 |
yum -y install gcc yum -y install openssl-devel libzip-devel zlib-devel libcurl-devel libcurl |
Download latest Python 2.7 from
https://www.python.org/downloads/
For Python 2.7.2 (latest at the time of writing this post).
1 2 3 4 5 6 |
cd /usr/local/src wget https://www.python.org/ftp/python/2.7.2/Python-2.7.2.tgz tar xvf Python-2.7.2.tgz cd Python-2.7.2 ./configure make altinstall |
We use “make altinstall” so python will be installed as python2.7. If you do “make install”, it replace system python binary and break CentOS.
Install pip
1 2 |
wget https://bootstrap.pypa.io/get-pip.py python2.7 get-pip.py |