最近修改了几个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. 三剑客-sed(简写)

    打印操作:n命令所有行打印,第二行打印两遍 sed '2p' passwd只打印第二行sed -n '2p' passwd打印1~3行 sed -n '1,3p' passwd 打印带有'root'的 ...

  2. Delphi 监视数据的值

  3. 面试复习题(二)JavaSE高级(未完成)

    一.Java中的反射 3.说说你对Java中反射的理解 Java中的反射首先是能够获取到Java中要反射类的字节码,获取字节码有3种办法. class.forName(className) 类名.cl ...

  4. IIS7设置限制IP地址访问

    1.拒绝访问设置,选择“一组计算机”,下面重点说明如何填写“网络标识”和“子网掩码”. IP地址按照IPV4的标准来分,分为A类地址.B类地址.C类地址,一般我们是屏蔽C类或者B类地址. A类地址:如 ...

  5. package+explorer不显示项目的问题

    昨天遇到了这个问题,百度了一下,怎么搞的都有,但是感觉都不理想,晚上的时候才在网上又发现这个方法,今天试了一下,效果还不错,分享一下. 点击 Window ---> Close All Pers ...

  6. echarts实践用法

    在折线图中,当点击某个节点,出现提示浮框,并且可以进行点击操作 echarts 配置 tooltip: { show: true, formatter: function(e) { return 'a ...

  7. HDU6739 2019CCPC秦皇岛赛区 I. Invoker

    题目:http://acm.hdu.edu.cn/showproblem.php?pid=6739思路:暴力dp           一个special skill最多有6种排列组合          ...

  8. react浏览器回退按钮的时候传递参数

    本来是有这个需求的,但是后来发现回退不也是到某个页面吗?接下来就使用了redux,真香啊,不管用户怎么操作,你到这个界面都给他一个值就完事了,没有就不给他这个值. 哈哈哈,公司框架使用umi.上代码 ...

  9. 【C#-枚举】枚举的使用

    枚举是用户定义的整数类型. namespace ConsoleApplication1 { /// <summary> /// 在枚举中使用一个整数值,来表示一天的阶段 /// 如:Tim ...

  10. node的安装和配置教程

    node,除了做数据服务处理,还是各大框架的环境依赖,作为前端开发人员,node是必不可少的.好了,接下来直接开始. 一.根据自己的安装环境(即你的电脑系统版本)下载对应安装包,官网地址:https: ...