CentOS under Python2.6 upgrade to Python3.5__python

Source: Internet
Author: User

1, download python3.5

wget https://www.python.org/ftp/python/3.5.0/Python-3.5.0.tgz

Note: If downloading is slow in Linux, you can download it from the Windows operating system to the Python website: https://www.python.org/downloads/release/python-350/

Note To download the gzipped source tarball version, and then use WINSCP to drag the downloaded file python-3.5.0.tgz to Linux, the next step remains unchanged.

2, decompression

Tar zxvf python-3.5.0.tgz

3, into the Python-3.5.0 folder

CD Python-3.5.0

4. Configure Installation Location

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

Note: If you do not install the C language compiler, you will be prompted for an error. If an error occurs, install the GCC compiler using the Yum install GCC command on networking

5, compile

Make

6, installation

Make install

7, download and install Setuptools 18.5

wget Https://bootstrap.pypa.io/ez_setup.py-O-| Python

Note: If prompted for error--no-check-certificate

After wget add--no-check-certificate:wget--no-check-certificate Https://bootstrap.pypa.io/ez_setup.py-O-| Python

8, backup the original Python command execution file

Mv/usr/bin/python/usr/bin/pythonbak

9. Create a new Python soft connection

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

10. View Python version

Python

[root@localhost python-3.5.0]# python
python 3.5.0 (default, OCT  7 2016, 04:34:35) 
[GCC 4.4.7 20120313 (Red H At 4.4.7-17)] on Linux
Type ' help ', ' copyright ', ' credits ' or ' license ' for the more information.
11, modify the Yum configuration file
Vim/usr/bin/yum

#!/usr/bin/python python modified to python2.6
import sys
try:
    import yum
except Importerror:
    print > > Sys.stderr, "" "\
There is a problem importing one of the Python modules
required to run yum. The error leading to this problem is:

   %s Please

install a package which provides this module, or
verify that The module is installed correctly.

It's possible that's above module doesn ' t match the current
version of Python, which are:
%s

If you cannot Solve this problem yourself, "go to the 
" Yum FAQ at:

Related Article

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.