linux中已经安装了python,但是执行python脚本还是提示报错:/usr/bin/env:‘python’:Nosuchfileordirectory。这里分享以下具体的解决方法。#linux专栏#
报错场景
[root
localhostdw]#./dwc.py/usr/bin/env:‘python’:Nosuchfileordirectory
解决方案
核实当前python版本信息
[root
localhostdm8_dsc_dw]#python3--versionPython3.6.8
使用命令whereis查看python3的文件具体位置
[root
localhostdm8_dsc_dw]#whereispython3python3:/usr/bin/python3.6/usr/bin/python3.6m/usr/bin/python3/usr/lib/python3.6/usr/lib64/python3.6/usr/include/python3.6m/usr/share/man/man1/python3.1.gz
创建一个python的软链接
[root
localhostdw]#ln-s/usr/bin/python3.6/usr/bin/python[root
localhostdw]#./dw.pysuccessful!
总结对于已经安装的服务,调用但是不存在的,肯能是因为版本差异导致的,可以通过软链接的方式解决。