当前位置: 首页 > 工具软件 > bash-parser > 使用案例 >

-bash-4.2#:vim: command not found解决办法

山森
2023-12-01

在linux命令行中输入vim+文件查看编辑时提示:-bash:vim: command not found 解决办法如下:

  1. 输入 rpm -qa|grep vim命令,查看返回结果, 如果返回的是三条结果:

vim-minimal-7.4.629-6.el7.x86_64
vim-enhanced-7.4.629-8.el7_9.x86_64
vim-filesystem-7.4.629-8.el7_9.x86_64
vim-common-7.4.629-8.el7_9.x86_64

则说明vim已经正确安装,如果缺少一条,则需要单独安装

2.单独安装某一条:

如果少了上面三条的某一条,
比如 vim-enhanced 的,就用命令 yum -y install vim-enhanced 来安装:

yum -y install vim-enhanced

比如 vim-minimal 的,就用命令 yum -y install vim-minimal 来安装:

yum -y install vim-minimal

比如 vim-filesystem 的,就用命令 yum -y install vim-filesystem 来安装:

yum -y install vim-filesystem

比如 vim-common 的,就用命令 yum -y install vim-common 来安装:

yum -y install vim-common

3.全部重新安装:
如果上面的三条都沒有返回, 可以直接用 yum -y install vim* 命令

yum -y install vim*

如果提示: -bash-4.2#: yum: command not found错误
在http://mirrors.163.com/centos/7/os/x86_64/Packages/下载以下RPM安装包

wget http://mirrors.163.com/centos/7/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm

安装

rpm -ivh python-iniparse-0.4-9.el7.noarch.rpm
rpm -ivh yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
rpm -ivh yum-3.4.3-168.el7.centos.noarch.rpm
rpm -ivh yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm
 类似资料: