CentOS 下 /usr/bin/env: ‘python’: No such file or directory 报错的解决方法

在 CentOS 下测试 youtube-dl 时,总是提示 /usr/bin/env: ‘python’: No such file or directory ,也就是说找不到 Python 的路径。

解决方案分两步:

第一步,确认是否安装了 Python2 或 Python3。根据自己的需要来选择安装 Python2 或 Python3。

sudo yum install python2

或者:

sudo yum install python3

第二步,创建软链接。有时候即使已经安装 Python 或 Python3,程序依旧会报这个错误,所以需要创建软链接指引程序应该到哪个位置去找。例如:

sudo ln -s /usr/bin/python3 /usr/bin/python

这样操作后一般程序就能正常运行了。

耕读君
耕读君

云时代的我们要学会“腾云驾雾”

文章: 185