Install Python 2.7.X on CentOS 6.X

Source: Internet
Author: User

Install Python 2.7.X on CentOS 6.X

The Python version of the CentOS 6.X comes with 2.6, and many times it requires 2.7 versions due to the work required. Therefore, a version upgrade is required. Because some system tools and services are dependent on Python, it is important to upgrade the Python version.

Upgrade steps

How joyful, no pain upgrade Python version, look down ...

Updating the system and development toolset

Update instructions

yum -y updateyum groupinstall -y ‘development tools‘

Additional packages required to install Python tools SSL, bz2, zlib

install -y zlib-devel bzip2-devel openssl-devel xz-libs wget
Source Installation Python 2.7.x
http://www.python.org/ftp/python/2.7.8/Python-2.7.8.tar.xzxz -d Python-2.7.8.tar.xztar -xvf Python-2.7.8.tar
Installation details:
# 进入目录:cd Python-2.7.8# 运行配置 configure:./configure --prefix=/usr/local# 编译安装:makemake altinstall# 检查 Python 版本:[[email protected] ~]# python2.7 -VPython 2.7.8
Set PATH

In order for us to be able to use Python conveniently, we need to set the system variables or establish a soft connection to make the new version of Python
Add to the directory that corresponds to path:

export PATH="/usr/local/bin:$PATH"or ln -s /usr/local/bin/python2.7 /usr/bin/python# 检查[root@dbmasterxxx ~]# python -VPython 2.7.8[root@dbmasterxxx ~]# which python /usr/bin/python
Installing Setuptools
#获取软件包wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-1.4.2.tar.gz# 解压:tar -xvf setuptools-1.4.2.tar.gzcd setuptools-1.4.2# 使用 Python 2.7.8 安装 setuptoolspython2.7 setup.py install
Install PIP
curl  https://bootstrap.pypa.io/get-pip.py | python2.7 -
Fix Yum Tool

Yum should be invalidated at this point because the default Python version is now 2.7. and Yum needs 2.6, so:

[root@dbmasterxxx ~]# which yum /usr/bin/yum#修改 yum中的python 将第一行  #!/usr/bin/python  改为 #!/usr/bin/python2.6此时yum就ok啦
Summarize
Python 版本升级过很多遍,每次都有问题,此方法来自互联网,经过使用,没有问题,特此总结一下

Install Python 2.7.X on CentOS 6.X

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.