Realization of coexistence of python2 and Python3 in Centos6.5

Source: Internet
Author: User

Installation of Python under Linux

The installation steps are as follows

1 Preparing the compilation environment

Yum Groupinstall ' Development Tools '

Yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel sqlit

2 Download Python3.5 Code package

wget HTTPS://WWW.PYTHON.ORG/FTP/PYTHON/3.5.2/PYTHON-3.5.2.TAR.XZ

3 compiling

Tar jxvf python-3.5.2.tar.xz

CD Python-3.5.2

./configure--prefix=/usr/local/python3

Make && make install

4 Setting environment variables

Echo ' Export path= $PATH:/usr/local/python3/bin ' >> ~/.BASHRC

5 Setting up the directory (this is done by typing Python3 in any directory of the system to invoke the python3.5 command)

Mv/usr/bin/python/usr/local/python.bak

Rm-rf/usr/local/python2

Ln-sv/usr/local/python2.6/usr/bin/python2

Ln-sv/usr/local/python3/bin/python3.5/usr/bin/python

6 Modify the Yum script to point to the old version of Python, which avoids Yum's inability to run

Sed-i ' S$#!/usr/bin/python$#!/usr/bin/python2.6$g '/usr/bin/yum

7 Testing

The input python appears as follows

650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M00/A4/36/wKioL1mmh4vDrtwaAAAiEiQNoz0936.png-wh_500x0-wm_ 3-wmp_4-s_168776994.png "style=" Float:none; "title=" Qq20170830173335.png "alt=" Wkiol1mmh4vdrtwaaaaieiqnoz0936.png-wh_50 "/>

650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M01/05/85/wKiom1mmh6CB9R02AAAiTVNEqtE337.png-wh_500x0-wm_ 3-wmp_4-s_1067576740.png "style=" Float:none; "title=" Qq20170830173357.png "alt=" Wkiom1mmh6cb9r02aaaitvneqte337.png-wh_50 "/>


This article is from the "surgery industry has specialized, if only" blog, please be sure to keep this source http://fustudy.blog.51cto.com/13154622/1961160

Realization of coexistence of python2 and Python3 in Centos6.5

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.