Python bad interpreter: No such file or directory
来源:互联网 发布:最靠谱的二手交易软件 编辑:程序博客网 时间:2024/06/05 04:44
这类错误有两种表现形式:
1、-bash: /usr/bin/yum: /usr/bin/python: bad interpreter: No such file or directory
这个错误是因为python的版本不匹配,只要在/usr/bin/yum中把第一行的#!/usr/bin/python改成#!/usr/bin/python2.4就可以啦~当然,我是指路径对的情况下,毕竟通常linux下的python默认版本都是2.4,当然,例外不算。
2、-bash: /usr/bin/yum: /usr/bin/python^M: bad interpreter: No such file or directory
有些时候,错误是这样显示的,那就不是python的版本问题了,属于编码问题。因为windows下的换行默认的是“换行+回车”,也就是“\n\r”,而linux下的换行默认的是“换行”,也就是“\n”,所以在windows下对yum进行修改的时候后面的“\r”linux是不认识的,会被默认成路径的一部分,显示出来就是“^M”.
所以这个问题的修改办法就是改变yum文件的编码
1)在windows下转换:
利用一些编辑器如UltraEdit或EditPlus等工具先将脚本编码转换,再放到Linux中执行。转换方式如下(UltraEdit):File-->Conversions-->DOS->UNIX即可。
2)也可在Linux中转换:
首先要确保文件有可执行权限
#sh>chmod a+x filename
然后修改文件格式
#sh>vi filename
利用如下命令查看文件格式
:set ff 或 :set fileformat
可以看到如下信息
fileformat=dos 或 fileformat=unix
利用如下命令修改文件格式
:set ff=unix 或 :set fileformat=unix
:wq (存盘退出)
最后再执行文件
#sh>./filename
:wq (存盘退出)
最后再执行文件
#sh>./filename
- Python bad interpreter: No such file or directory
- bad interpreter: No such file or directory
- bad interpreter: No such file or directory
- bad interpreter: No such file or directory
- bad interpreter: No such file or directory
- bad interpreter: No such file or directory
- bad interpreter: No such file or directory
- bad interpreter: No such file or directory
- bad interpreter: No such file or directory
- bad interpreter: No such file or directory
- bad interpreter: No such file or directory
- bad interpreter: No such file or directory
- bad interpreter: No such file or directory
- bad interpreter: No such file or directory
- 出现bad interpreter:No such file or directory的原因
- 出现bad interpreter:No such file or directory的原因
- 出现bad interpreter:No such file or directory的原因
- 出现bad interpreter:No such file or directory的原因
- myeclipse设置自定义快捷方式的方法
- memcpy,strcpy
- Connecting the embedded ubuntu to wifi networks from the command line
- POJ2387--Til the Cows Come Home--Dijkstra算法裸题
- ARP协议笔记
- Python bad interpreter: No such file or directory
- 解决刷了Gargoyle固件后某些LED灯不亮的问题
- ASP.NET @Page指令属性
- linux下启动相关oracle服务与监听的命令
- CustomValidator的使用方法
- Liferay Inter-portlet communication(client side)
- html js
- 祝福你,李琛~
- 如何解决IE内存泄漏