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 *