最近修改了几个python文件,发现在linux上只能用python file来执行,直接./file提示错误“no such file or directory”,而脚本是用“#!/usr/bin/env python”开头的,应该是可以直接执行的。 

  一般情况下,这个错误是由于没有权限导致的。但是这个脚本是有执行权限的。google后发现,原来是格式的问题!之前有几次我把文件ftp到windows上编辑,估计是不小型点了转换格式的按钮。。。手贱啊。。
http://www.gossamer-threads.com/lists/python/python/77314
/usr/bin/env: python: No such file or directory [In reply to]

> When trying to run a script, I get the following message: 

> /usr/bin/env: python: No such file or directory 

Though perhaps not the case here, I'll just mention a problem that is 
worth being aware of when transferring a script from a Windows/DOS 
system to Unix. If the difference in line-ending conventions hasn't 
been taken care of (such as by using ASCII mode during FTP transfer), 
then the spurious ^M in the script's #! line can trip up the shell or 
the env command, since it will be trying to run the program python^M. 

Hamish Lawson

/usr/bin/env python no such file or directory: dos格式导致的!的更多相关文章

  1. 调用python脚本报错/usr/bin/env: python : No such file or directory

    一.调用python脚本报错 /usr/bin/env: python: No such file or directory 二.解决方法 原因是在windows上编写的脚本,使用dos2unix对脚 ...

  2. Cannot install NodeJs: /usr/bin/env: node: No such file or directory

    安装doxmate时,doxmate地址是:https://github.com/JacksonTian/doxmatenpm install doxmate -g 安装完后把错误:Cannot in ...

  3. /usr/bin/env: node: no such file or directory

    今天在安装gulp的之后,运行gulp命令出现了如下报错: /usr/bin/env: node: no such file or directory 网上找了好久,终于解决了,所以记录一下,便于下次 ...

  4. 【node错误】/usr/bin/env: node: No such file or directory

    背景 安装了node后,执行npm run xxx的命令的时候,报错,提示如下: /usr/bin/env: node: No such file or directory 步骤 1. 什么玩意,执行 ...

  5. 安装nodejs和grunt以后出现 /usr/bin/env: node: No such file or directory

    安装完成以后需要执行此命令 sudo ln -s /usr/bin/nodejs /usr/bin/node

  6. /usr/bin/env: php: No such file or directory 【xunsearch demo项目体验】【已解决】

    出现这个问题的原因是/usr/local/bin 或 /usr/bin 下面没有php可执行文件 解决办法: 建立一条硬链接 ln /path/to/bin/php  /usr/local/bin/p ...

  7. [xampp] /usr/bin/env: php: No such file or directory

    ln -s /opt/lampp/bin/php /usr/local/bin/php

  8. ubuntu 执行Python脚本出现: /usr/bin/env: ‘python\r’: No such file or directory

    原因: #!/usr/bin/env python 在ubuntu会变成 #!/usr/bin/env python\r 而\r 会被shell 当成参数 所以出现:  /usr/bin/env: ‘ ...

  9. #!/usr/bin/env python与#!/usr/bin/python的区别

    [摘自:http://blog.csdn.net/wh_19910525/article/details/8040494] 一般的python文件的开头都有#!/usr/bin/python.这是什么 ...

随机推荐

  1. int 问号的使用

    单问号---为泛型 Nullable<int> 的简写方式. 双问号---用于判断前一个操作数是否为null,如为null则"返回"后一个操作数,否则"返回& ...

  2. RabbitMQ核心技术总结

    RabbitMQ和kafka类似,也是一个消息服务.RabbitMQ是轻量级的,易于部署在内部和云端.RabbitMQ支持多种消息协议,可以部署在分布式集群中,能够满足高规模,高可用性要求.Rabbi ...

  3. LVM使用手册简化命令

    创建 hot_add    --查看新增的lun pvcreate /dev/sdb   --创建物理卷 pvcreate /dev/sdc   --创建物理卷 pvcreate /dev/sdd   ...

  4. Linux中FTP服务器配置

         1.FTP服务器的一些基本概念       (1)FTP连接方式     控制连接:标准端口为21,用于发送FTP命令信息.     数据连接:标准端口为20,用于上传.下载数据.      ...

  5. 使用Pechkin与CPechkin生成PDF

    1. Pechkin     从NuGet程序管理器中获得Pechkin,代码示例如下:             GlobalConfig config = new GlobalConfig();   ...

  6. filter和filter_by 的区别

  7. VMware Horizon Client剪贴板异常问题解决

    接到用户反馈现象是:登录ERP系统操作是,无法复制粘贴本地电脑上的数据. 处理过程: 1.在域控服务器上建立独立的Horizon Computer OU,把所有RDS加入在改OU中 2.针对Horiz ...

  8. MHA监控进程异常退出(MHA版本:0.56)

    最近遇到一个非常诡异的问题,mha后台进程自己中断退出了.以下是报错:Mon Dec 21 20:16:07 2015 - [info] OK.Mon Dec 21 20:16:07 2015 - [ ...

  9. 封装ORM.py与mysql_client.py代码

    ORM.py ''' ORM: 对象关系映射 ---> 映射到数据库MySQL中的数据表 类名 ---> 表名 对象 ---> 一条记录 对象.属性 ---> 字段 模拟Dja ...

  10. STM32CubeIDE查看内存使用情况

    按照下图操作 在右下角即可显示