How to Install Python 2.7 on CentOS6.5

Today, I was trying to install an application on my CentOS 6.5 system which required Python >= 2.7, but there are Python 2.6 installed, which we can’t remove as other application’s depends on it. This tutorial will help you to install Python 2.7 without removing older versions.

Step 1: Install GCC

Firstly make sure that you have gcc package installed on your system. Use following command to install gcc if you don’t have it installed.

# yum install gcc

Step 2: Download Python 2.7

Download Python using following command from python official site. You can also download latest version in place of specified below.

# cd /usr/src
# wget https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tgz

Step 3: Extract Archive and Compile

Use below set of commands to extract Python source code and compile it on your system using altinstall.

# tar xzf Python-2.7.12.tgz
# cd Python-2.7.12
# ./configure
# make altinstall

make altinstall is used to prevent replacing the default python binary file /usr/bin/python.

Step 4: Check the Python Version

Check the latest version installed of python using below command

# python2.7 -V

Python 2.7.12
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值