CentOS7 upgrade Python While addressing yum corruption issues

Source: Internet
Author: User

Python version in CentOS7 is python2.7.5, there are two issues to be aware of when upgrading to the latest version of Python

    • The new version of Python is installed to modify the Python system by default pointing to the problem
    • Yum error issues after upgrading to the latest version of Python

The following is a description of the new installation steps.

 First, download and install the latest version of Python

1. Download and unzip

# wget https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz# tar-zxf python-3.5. 2. tgz

2. Install Python

# CD python-3.5. 2
# make
# make Install

To see if the installation was successful

#/usr/local/bin/python3.5

[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on Linux
Type "Help", "copyright", "credits" or "license" for more information.

3. Modify Python's system default point, modify Soft link

Under normal circumstances, the python environment that other applications such as the new version of the Python post installation system point to is still the old version of Python,

If you remove the old version and then install the new version will face a lot of difficult to locate the trouble, so the usual practice is:

The old version remains, the new version exists in parallel. Here's how it works

(1Modify the system default Python modification to 2.7. 5 version # MV/usr/bin/python/usr/bin/python2.7.5(2Create a soft connection so Python points to the new version # ln-s/usr/local/bin/python3.5/usr/bin/Python (3) detect if the update is successful [email protected]~]# Pythonpython3.5.2(default, Jul -  ., -: $: -) [GCC4.8.5 20150623(Red Hat4.8.5-4)] on Linuxtype" Help","Copyright","credits"Or"License"  forMore information.>>>

Second, yum error problem resolution

1. The error message is as follows when you enter Yum under Terminal

[Email protected] ~]# Yum   " /usr/bin/yum "  -     except Keyboardinterrupt, E:                            ^syntaxerror:invalid syntax

2.vim/usr/bin/yum

Modify Python head python to python2.7.5

#!/usr/bin/python2. 7.5 Import SYS Try :    import yumexcept importerror:    ""\ This problem is:

3. See if Yum is available again

[[Email protected] ~]# yumloaded plugins:fastestmirror, langpacksyou need to give some commandusage:yum [options] CO Mmandlist of Commands:check          for on the  rpmdbcheck-update for     Available package Updatesclean          Remove cached datadeplist        List apackage's dependencies ... ...

CentOS7 upgrade Python While addressing yum corruption issues

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.