最近修改了几个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. Flask-migrate基本使用方法

    数据库迁移操作顺序: 1.python 文件 db init 2.根据需求修改模型 3.python flaskapp文件 db migrate -m"新版本名(注释)" 4.py ...

  2. python 运行sum函数的使用

    sum(iterable[, start]) ,iterable为可迭代对象,如: sum([ ], start) , #iterable为list列表. sum(( ), start ) , #it ...

  3. vs2017的主题颜色的配置

    相信很多小伙伴开发的时候很怀念sublime的主题,我也特别的喜欢其中的mono主题,所以闲来无事在vs上调了一下色感觉好看多了.(其实也可以下载主题然后用“导入导出设置但是颜色有点奇葩,还是越简单越 ...

  4. linux chattr:配置文件隐藏属性;lsattr:显示文件属性

    1    chattr [+-=][ASadistu] 文件或目录名称 选项与参数: + :在原有参数设定基础上,追加参数.- :在原有参数设定基础上,移除参数.= :更新为指定参数设定.A:文件或目 ...

  5. Jenkins 入门系列--Jenkins 的安装配置

    写的我想吐血,累死了. 网页看着不爽的,自己去下载PDF.有问题请留言! Jenkins入门系列之--03PDF文档下载 第二章 Jenkins安装与配置 2 Jenkins安装 在最简单的情况下,J ...

  6. Mandelbrot集合及其渲染

    什么是Mandelbrot集合? Mandelbrot集合是在复数平面上组成分形的点的集合,它正是以数学家Mandelbrot命名. Mandelbrot集合可以用复二次多项式 \[ f_c(z)=z ...

  7. Java语言基础(2)

    1 包的概念 把一个项目分割成几个模块,为每一个模块建立包,把该模块的.java文件统一放到对应包,通过包更好的管理.java文件,并且更好的分工合作.可以尽量避免出现.java文件重名现象. 包命名 ...

  8. hive不分区增量更新

    insert overwrite table ods.zeg_so select *,case when zsm.id is not null then cast(current_timestamp ...

  9. usb server

    usb server 是通道型的,驱动在客户端安装 服务端不需要驱动

  10. 并查集+优先队列+启发式合并 || 罗马游戏 || BZOJ 1455 || Luogu p2713

    题面:P2713 罗马游戏 题解: 超级大水题啊,特别水.. 并查集维护每个人在哪个团里,优先队列维护每个团最低分和最低分是哪位,然后每次判断一下哪些人死了,随便写写就行 并查集在Merge时可以用启 ...