我正在尝试运行python脚本.它运行时它工作正常:
python2.5 myscript.py inpt0
当我添加一个shebang时,问题就出现了:
#!/usr/bin/env python2.5
造成:
$ myscript.py inpt0 : No such file or directory
试试2:
#!/usr/local/bin/python2.5
造成:
$ myscript.py inpt0 : bad interpreter: No such file or directoryon2.5
当我直接在终端中运行它们时,它们都工作得很好:
$ /usr/local/bin/python2.5 Python 2.5.4 (r254:67916, Feb 9 2009, 12:50:32) [GCC 3.2.3 20030502 (Red Hat Linux 3.2.3-52)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> $ /usr/bin/env python2.5 Python 2.5.4 (r254:67916, Feb 9 2009, 12:50:32) [GCC 3.2.3 20030502 (Red Hat Linux 3.2.3-52)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>>
有关如何使用shebang工作的任何提示?
我遇到了类似的问题,结果证明是行结尾的问题.你使用windows/linux/mac line结尾?
编辑:忘记了脚本名称,但正如OP所说,它是 dos2unix