Solve yum command failure in CentOS, vim: command not found

Source: Internet
Author: User

Solve yum command failure in CentOS, vim: command not found

When installing the python 3 module,The yum command cannot be executed.

Error:

**/Usr/bin/yum: line 3: import: command not found

/Usr/bin/yum: line 4: try: command not found

/Usr/bin/yum: line 5: import: command not found

/Usr/bin/yum: line 6: Rule T: command not found

/Usr/bin/yum: line 24: syntax error near unexpected token '('

/Usr/bin/yum: line 24: '"" % (sys. exc_value, sys. version )'**

Cause: upgrade to python3

Solution:

1. view the yum version:

Rpm-qa | grep yum

2. view the Python version

Under the cd/usr/bin directory

Ll python *

Or python-V

3. I guess yum calls a later version of python.

4. Search for the yum and yum-updatest files and edit the py files.

[Root @ Master2 ~] # Which yum

/Usr/bin/yum

[Root @ Master2 ~] #

[Root @ Master2 ~] # Vi/usr/bin/yum

Set

#! /Usr/bin/python

Changed:

#! /Usr/bin/python2.6

Then save OK.

Solve centos-bash: vim: command not found

How can we install vim?

Enter the rpm-qa | grep vim command. If vim is correctly installed, the following three lines of code are returned:

Root @ server1 [~] # Rpm-qa | grep vim

Vim-enhanced-7.0.109-7.el5

Vim-minimal-7.0.109-7.el5

Vim-common-7.0.109-7.el5

If one of them is missing, such as vim-enhanced, run the yum-y install vim-enhanced command to install the security rule:

Yum-y install vim-enhanced

If none of the preceding three statements are returned, run the yum-y install vim * command.

Yum-y install vim *

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.