window下编辑的python文件复制到linux上,运行后出现 /usr/bin/python3^M: bad interpreter: No such file or directory
1.使用file命令
file cards_main.py
cards_main.py: a /usr/bin/python3 script, UTF-8 Unicode text executable, with **CRLF** line terminators
发现CRLF是windows下的空格
解决办法
vi cards_main.py
修改格式为unix
:set ff=unix 或者 :set fileformat=unix
解决后
file cards_main.py
a /usr/bin/python3 script, UTF-8 Unicode text executable