最近修改了几个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. vue+webpack项目环境搭建

    首先安装node.js 下载地址:https://nodejs.org/en/download/ 看下是否成功安装 node -v 安装webpack,命令行npm install webpack - ...

  2. java_day01

    ch01: ===================================== java J2SE 桌面应用的开发 JAVA SE corejava J2EE 企业级开发 JAVA EE J2 ...

  3. RAID原理详解

    RAID 0(stripe,条带化存储):在RAID级别中最高的存储性能. 原理:是把连续的数据分散到多个磁盘上存取,系统有数据请求就可以被多个磁盘并行的执行,每个磁盘执行属于他自己的那部分数据请求. ...

  4. LIS 普及题

    题意 给你一个长度为 \(n\) 的序列 \(a\). 问是否存在一个长度为 \(L\) 的上升子序列,即存在 \(\{x_1,x_2,...,x_L\}(x_1\lt x_2\lt ...\lt x ...

  5. IANA

    IANA,全称The Internet Assigned Numbers Authority,即互联网数字分配机构1. Internet已成为全球范围的网络.为保证其正常运作,全球有很多机构参与进来. ...

  6. 宝塔linux面板命令大全 - 宝塔面板

    安装宝塔 Centos安装脚本 yum install -y wget && wget -O install.sh http://download.bt.cn/install/inst ...

  7. tomcat 搭建网站

    基本概念 JDK(Java Development Kit)是Sun Microsystems针对Java开发人员的产品.自从Java推出以来,JDK已经成为使用最广泛的Java SDK.JDK 是整 ...

  8. 红帽Linux故障定位技术详解与实例(1)

    红帽Linux故障定位技术详解与实例(1) 2011-09-28 14:26 圈儿 BEAREYES.COM 我要评论(0) 字号:T | T 在线故障定位就是在故障发生时, 故障所处的操作系统环境仍 ...

  9. MAC下安装Homebrew和GDB,并解决无法调试问题

    Homebrew官网 http://brew.sh/index_zh-cn.html Homebrew是神马 linux系统有个让人蛋疼的通病,软件包依赖,好在当前主流的两大发行版本都自带了解决方案, ...

  10. C# 扩展方法——去重(Distinct)

    其他扩展方法详见:https://www.cnblogs.com/zhuanjiao/p/12060937.html IEnumerable的Distinct扩展方法,当集合元素为对象时,可用于元素对 ...