How to make python script executable on osx?

后端 未结 4 1211
没有蜡笔的小新
没有蜡笔的小新 2021-01-14 04:19

I just want to make my script as an application. double-click and run instead of running in terminal. I have done it before with automator but now, on el capitan it doesn\'t

4条回答
  •  生来不讨喜
    2021-01-14 04:38

    I have changed the mode by

    sudo chmod +x file-name.py

    Then Added the following line on top of the file-name.py

    #!/usr/bin/env python

    Then run the file by running ./file-name.py command and it works fine.

提交回复
热议问题