CentOS 6.9 Compile and install Python-2.7.10

Source: Internet
Author: User

Python Official website: https://www.python.org/

First, view CentOS version and system default Python version:

# Cat/etc/redhat-release

# python-v

650) this.width=650; "src=" https://s2.51cto.com/wyfs02/M00/A5/3A/wKioL1m56_qjylakAABUuGv-WIM357.jpg "title=" 1.jpg "Width=" height= "border=" 0 "hspace=" 0 "vspace=" 0 "style=" WIDTH:300PX;HEIGHT:57PX; "alt=" wkiol1m56_ Qjylakaabuugv-wim357.jpg "/>

second, compile and install Python-2.7.10 :

1. Install dependent packages and package groups:

# yum-y Groupinstall "Development tools"

# yum-y Install zlib-devel bzip2-devel openssl-devel ncurses-develsqlite-devel readline-devel tk-devel gdbm-devel db4-de Vel Libpcap-develxz-devel Mans

2. Set CentOS 6.9 Current system time:

# date 071017452017.20

# date

3. Compiling the installation Python-2.7.10 :

# TAR-XF Python-2.7.10.tar.xz-c/usr/src

# cd/usr/src/python-2.7.10

#./configure--prefix=/usr/local/python2.7.10--enable-shared--enable-profiling--disable-ipv6-- With-signal-module--with-dec-threads--with-threads--with-pth--with-doc-strings--WITH-TSC-- With-pymalloc--with-wctype-functions--with-fpectl | Tee/tmp/python2.7.10.out

# Less/tmp/python2.7.10.out

# Make && make install

4. Change CentOS 6.9 the default Python version is 2.7.10 :

# Mv/usr/bin/python/usr/bin/python2.6.6-old

# ln-s/usr/local/python2.7.10/bin/python2.7/usr/bin/python

5. Add to PATH Environment variables:

# vim/etc/profile.d/python2.7.10.sh

Export Path=/usr/local/python2.7.10/bin: $PATH

# . /etc/profile.d/python2.7.10.sh

# echo $PATH

6. Configuration header file:

# ln-s/usr/local/python2.7.10/include/usr/include/python2.7.10

7. To Configure the library file:

# echo "/usr/local/python2.7.10/lib" >/etc/ld.so.conf.d/python2.7.10.conf

# cat/etc/ld.so.conf.d/python2.7.10.conf

# Ldconfig

8. Configuration Mans Help Documentation:

# Vim/etc/man.config , add the following code:

Manpath/usr/local/python2.7.10/share/man

9. after viewing the configured Python version:

# python-v

# python2-v

650) this.width=650; "src=" https://s3.51cto.com/wyfs02/M01/06/8A/wKiom1m57IyBPdpJAABEQCcf8GA336.jpg "title=" 2.jpg "Width=" height= "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:220px;height:63px; "alt=" Wkiom1m57iybpdpjaabeqccf8ga336.jpg "/>

three, will yum python version modified to system original 2.6.6 version:

Upgrade Python will cause Yum cannot be used:

650) this.width=650; "src=" https://s3.51cto.com/wyfs02/M02/06/8A/wKiom1m57LGTo-fEAAGuNBgF5rk548.jpg "title=" 3.jpg "Width=" "height=" 262 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:450px;height:262px; "alt=" Wkiom1m57lgto-feaagunbgf5rk548.jpg "/>

# Vim/usr/bin/yum , the first line of " #!/usr/bin/python "Modify to" #!/usr/bin/python2.6.6-old "

650) this.width=650; "src=" https://s5.51cto.com/wyfs02/M00/06/8A/wKiom1m57Mij3WGxAADnTS21wUU027.jpg "title=" 4.jpg "Width=" 380 "height=" 161 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:380px;height:161px; "alt=" Wkiom1m57mij3wgxaadnts21wuu027.jpg "/>

Iv. Pythonversion from2.6.6Upgrade to2.7.10, causingPipUnable to use, fixPip:

# pip-v

650) this.width=650; "src=" https://s5.51cto.com/wyfs02/M02/06/8A/wKiom1m57YCRRGbxAAAp9S4ll80756.jpg "title=" 5.jpg "Width=" "height=" "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:250px;height:36px; "alt=" Wkiom1m57ycrrgbxaaap9s4ll80756.jpg "/>

# yum-y Install Python-pip wget

650) this.width=650; "src=" https://s2.51cto.com/wyfs02/M01/A5/3A/wKioL1m57WOgvR_YAACO3wCBx5Q915.jpg "title=" 6.jpg "Width=" 380 "height=" "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" wkiol1m57wogvr_yaaco3wcbx5q915.jpg "style=" width : 380px;height:83px; "/>

# wget-q https://bootstrap.pypa.io/get-pip.py

# python get-pip.py

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M02/A5/3A/wKioL1m57abTwZyKAAF-0iI_c_0155.jpg "style=" width : 500px;height:191px; "title=" 7.jpg "width=" "height=" 191 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" Wkiol1m57abtwzykaaf-0ii_c_0155.jpg "/>

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M00/A5/3A/wKioL1m57ajiuCaUAAQE2v4ultA629.jpg "style=" width : 1000px;height:332px; "title=" 8.jpg "width=" "height=" 332 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" Wkiol1m57ajiucauaaqe2v4ulta629.jpg "/>

# Mv/usr/bin/pip/usr/bin/pip2.6.6-old

# ln-s/usr/local/python2.7.10/bin/pip2.7/usr/bin/pip

650) this.width=650; "src=" https://s3.51cto.com/wyfs02/M02/A5/3A/wKioL1m57YWj1uMuAAIF6vPoMW4029.jpg "title=" 9.jpg "Width=" "height=" 182 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:800px;height:182px; "alt=" Wkiol1m57ywj1umuaaif6vpomw4029.jpg "/>


This article is from the "Tiandaochouqin" blog, make sure to keep this source http://qiuyue.blog.51cto.com/1246073/1965160

CentOS 6.9 Compile and install Python-2.7.10

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.