最近修改了几个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. CF1151F Sonya and Informatics

    cf luogu 我们最终要的序列一定是前面全是0,后面全是1,假设总共\(m\)个0,那么这等价于前\(m\)位0的个数为\(m\).当然一开始可能数量没有\(m\) 那就把前\(m\)位0的数量作 ...

  2. svn add 忽略node_modules

    一劳永逸 这个窗口怎么打开 桌面右键,TortoiseSvn,然后点settings,加如下代码,要加空格 node_modules 参考: https://www.leixuesong.cn/336 ...

  3. angular项目中ts的配置编译tsconfig.json

    { "compilerOptions": { /* 基本选项 */ "target": "es5", // 指定 ECMAScript 目标 ...

  4. ios 动画:底部标签栏的概念设计

    本文汇集了大量优秀的ios底部标签栏动效设计,并附上技术实现的指南,对于设计师和开发者都提供了很好的灵感来源和学习资源. 我们每天都见到tab bars,它们指引用户,使得他们能够快速在不同的tab中 ...

  5. 工作中apache 403的一个小问题

    最近在虚拟机上安装hadoop, 需要设备本地的网络源,所以启用了apache. 由于需要,首先修改了家目录的位置 指向/opt/www   然后修改家目录的配置文件 修改完成之后重启服务,访问目录 ...

  6. 两种Tensorflow模型保存的方法

    在Tensorflow中,有两种保存模型的方法:一种是Checkpoint,另一种是Protobuf,也就是PB格式: 一. Checkpoint方法: 1.保存时使用方法: tf.train.Sav ...

  7. 使用TensorFlow玩GTA5

    小白学TensorFlow(一) tensorflow安装 在安装之前,您必须选择以下类型的TensorFlow之一来安装: TensorFlow仅支持CPU支​​持.如果您的系统没有NVIDIA®G ...

  8. ecshop新建增加独立页面的方法

    ecshop是通过php文件来指向dwt文件的,比如index.php是程序文件,那么其模板文件就是index.dwt 那么如果新建一个php文件来单独做其他作用呢?其实很简单 第一步: 将index ...

  9. 第三章 指令-- 30 指令-使用钩子函数的第二个binding参数拿到传递的值

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8&quo ...

  10. Linux文件类型和文件相关命令

    文件类型 ll后可以看到文件详情: -:常规文件(内部类型是什么,用file命令) d:directory,目录文件 b:blobk device,块设备文件,支持以“block”为单位进行随机访问 ...