Home > Others > Installing `python 2.7.x` on Centos 6.5/6.6

Installing `python 2.7.x` on Centos 6.5/6.6

By default centos comes with python 2.6. In most of the cases we might need python 2.7 or later to be installed. Below are few ways to install python 2.7 on centos 6.x.

Method 1 – Using SCL (centos 6.5 and earlier)

First off, update the system to the latest state. Just in case there are any pending fixes.
yum -y update

Next install the SCL Softwate Collection repository for centos.

yum install centos-release-SCL 
yum install python27

Setting the default for the shell.

scl enable python27 bash
This will set all the path required.

Installing pip.

wget http://ift.tt/1mn7OFn
sudo python27 get-pip.py

Method 2 – Manual Install (For Centos version earlier than 6.5).

First off, update the system to the latest state. Just in case there are any pending fixes.
yum -y update

Install Dev Tools

yum groupinstall -y 'development tools'
yum install -y zlib-devel openssl-devel sqlite-devel bzip2-devel

Download Python, Configure, build and Install.

wget http://ift.tt/Vdm9Ng  
tar -xvzf Python-2.7.8.tgz
Configure and build python and Install.
cd Python-2.7.8
./configure --prefix=/usr/local
make
Install python.
make altinstall  

Setting path and Installing pip

# Example: export PATH="[/path/to/installation]:$PATH"
export PATH="/usr/local/bin:$PATH"
Installing pip.
wget http://ift.tt/1mn7OFn
sudo python27 get-pip.py
More details in the link here

from Blogger http://ift.tt/1SZKSQk
via IFTTT

Advertisements
Categories: Others Tags: ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: