Notes: Install Python 2.7 on Cent OS 7 from Source

I enabled the EPEL repository.
Enable EPEL repository.

I upgraded setuptools.

$ sudo yum update python-setuptools

I installed python-pip.

$ sudo yum -y install python-pip

I installed pre-requisites.

$ yum groupinstall "Development tools"
$ yum install zlib-devel bzip2-devel openssl-devel ncurses-devel 
$ yum install sqlite-devel readline-devel tk-devel gdbm-devel 
$ yum install db4-devel libpcap-devel xz-devel

I could have actually issued the above yum install commands in one-line but..

I downloaded Python 2.7.10.

$ mkdir -p ~/Downloads
$ cd ~/Downloads
$ wget

I extracted the compressed file.

$ tar -xzf Python-2.7.10.tgz

I installed Python 2.7.10 from source.

$ cd Python-2.7.10
$ ./configure
$ make
$ sudo make altinstall

I created a symlink to Python 2.7 in /usr/local/bin which is on my PATH environment variable. (optional)

$ cd /usr/local/bin
$ sudo ln -s python2.7 python

It works!!

Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.