1. 程式人生 > >ubuntu 執行Python腳本出現: /usr/bin/env: ‘python ’: No such file or directory

ubuntu 執行Python腳本出現: /usr/bin/env: ‘python ’: No such file or directory

pid pytho shell ati director htm stat 參數 art

原因:

#!/usr/bin/env python

在ubuntu會變成

#!/usr/bin/env python\r

而\r 會被shell 當成參數

所以出現: /usr/bin/env: ‘python\r’: No such file or directory

解決方法:

vi 此文件

輸入:set ff=unix

再輸入:wq 保存

運行成功。

ubuntu 執行Python腳本出現: /usr/bin/env: ‘python\r’: No such file or directory