当前位置: 首页 > article >正文

解决CentOS 7 yum install 出现 No such file or directory 错误的方案

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]#

 


http://www.kler.cn/news/331012.html

相关文章:

  • 微软准备了 Windows 11 24H2 ISO “OOBE/BypassNRO“命令依然可用
  • PDF转换为TIF,JPG的一个简易工具(含下载链接)
  • 《深度学习》OpenCV 图像拼接 拼接原理、参数解析、案例实现
  • ARM 架构、cpu
  • MATLAB中的艺术:用爱心形状控制坐标轴
  • 828华为云征文 | 华为云Flexus云服务器X实例搭建企业内部VPN私有隧道,以实现安全远程办公
  • html空单元格的占位
  • 浙大数据结构:06-图2 Saving James Bond - Easy Version
  • 【JavaWeb】JavaWeb笔记 HTTP
  • iOS 提取图片的主题色,并支持灵活提取
  • 前端编程艺术(1)---HTML
  • 机器学习(1):机器学习的概念
  • Elasticsearch分布式搜索引擎入门
  • PDF转PPT:四款热门工具的亲身体验分享!
  • 如何更改 Ubuntu/Linux 终端中命令行提示符的颜色
  • 每日学习一个数据结构-AVL树
  • Axios入门使用
  • SKD4(note上)
  • 好玩的进3D度条
  • 怎么查看是公网ip还是私网ip