CentOS 7 yum install
出现No such file or directory
错误的解决方案:
[root@centos7 ~]# yum install -y git
File "/usr/bin/yum", line 30
except KeyboardInterrupt, e:
^
SyntaxError: invalid syntax[root@centos7 ~]# yum
-bash: /usr/bin/yum: /usr/bin/python: bad interpreter: No such file or directory
yum
找不到/usr/bin/python
。正常情况,应该是这个样子:
[root@centos7 ~]# ls -l /usr/bin/python
lrwxrwxrwx. 1 root root 7 Jul 9 11:08 /usr/bin/python -> python2
[root@centos7 ~]#
CentOS7 应该使用 python2,而不是 python3 来执行 yum
可能 默认 python 版本已更改为 python3。
查看Python2
位置
[root@centos7 ~]# which python2
/usr/bin/python2
如果python2
本身仍然存在,但/usr/bin/python
符号链接丢失或者指向Python3
,可以使用以下方法恢复:
[root@centos7 ~]# cd /usr/bin
[root@centos7 bin]# ln -s python2 python
[root@centos7 bin]# ls -l python
lrwxrwxrwx. 1 root root 7 Jul 9 11:10 python -> python2
[root@centos7 bin]#
这个解决方法有效!如果符号链接存在但是坏了,则我必须删除坏的符号链接,然后在执行上面代码恢复。
最新评论
这可是个好东西啊,网站收藏了,抽空搞个VPS
那个国家选错了可以更改吗?
设备限制支持5个设备,我5个设备已经用满了,并且有一个设备不用了,怎么更换设备呢,怎么将不用的设备解绑呢?
还是不行,用了一天443端口就被墙了,防火墙似乎对这个端口特别敏感
服了 刚好是华为用户 请问该怎么办?
楼主你好,我安装了解锁ChatGpt的一键脚本,可是我想卸载,不知道怎么卸载