Linux CentOS6 compile and install Python2.7

Source: Internet
Author: User

The centos6.x system is always in the python2.6.x (currently the latest version is python-2.6.6), sometimes not meet the needs of some application production environment and development environment, directly from the official Yum Warehouse and Epel installed Python2.7 (the latest version is python-2.7 .12) It does not seem to be possible unless you use a more tripartite source of software. There are many system components in the centos6.x system that use Python2.6, such as the Yum mentioned earlier, but Yum is not necessarily the only program that relies on Python2.6, although in general production environments are not used in a particularly promiscuous environment, some tools need to be observed during use & whether the program can run normally under Python2.7.

Installing python2.7.x is actually very simple, and the only thing you need to know is that you must use--enable-shared when compiling the installation python2.7.x (enable building shared Python Library) option to install the Python dynamic Link libraries (Share object,/usr/lib64/ libpython2.7.so.1.0), this file will be used by many Python modules (and even Python itself), when this option is not used, you can add this option to recompile Python, the steps are shown below.

https://www.python.org/downloads/

wget -c https://www.python.org/ftp/python/2.7.12/python-2.7.12.tgzwget -c https:// www.python.org/ftp/python/2.7.12/Python-2.7.12.tgz.ascwget https://www.python.org/static/files/ Pubkeys.txtgpg --import pubkeys.txtgpg --recv-keys 6a45c816 36580288 7d9dc8d2  18ADD4FF A4135B38 A74B06BF EA5BBD71 ED9D77D5 E6DF025C AA65421D  6f5e1540 f73c700d 487034e5gpg --verify python-2.7.12.tgz.asc # good  signaturetar zxf python-2.7.12.tgz cd python-2.7.12/yum install -y gcc  gcc-c++ openssl-devel./configure --enable-shared make && make  installecho  '/usr/local/lib '  > /etc/ld.so.conf.d/libpython2.7.confldconfigpython -- versionsed -i  ' 1 s/python/python2.6/g '  /usr/bin/yumwget https://bootstrap.pypa.io/ez_ Setup.pypython ez_setup.py  # setuptoolseasy_install  --versionwget https://bootstrap.pypa.io/get-pip.pypython get-pip.py   # pippip --version

Tag:centos Python2.7,centos Install python2.7, compile and install python2.7
--end--



This article is from "Communication, My Favorites" blog, please make sure to keep this source http://dgd2010.blog.51cto.com/1539422/1876660

Linux CentOS6 compile and install Python2.7

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.