最近修改了几个python文件,发现在linux上只能用python file来执行,直接./file提示错误“no such file or directory”,而脚本是用“#!/usr/bin/env python”开头的,应该是可以直接执行的。
/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 LawsonPasted from: <http://www.gossamer-threads.com/lists/python/python/77314>