env: python3\r: No such file or directory

Posted in :

在 macOS 裡,直接執行 .py 的檔案,會顯示錯誤訊息:

env: python3\r: No such file or directory

程式內容的開頭:

#!/usr/bin/env python3
#encoding=utf-8

發生原因,程式的「Line Endings」使用了Windows 的格式,經測試使用 Mac OS 9 格式也會出錯,改用 Unix 格式程式就可以正常執行。

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *