How to make python script executable on osx?

后端 未结 4 1190
没有蜡笔的小新
没有蜡笔的小新 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:39

    Quick step-by-step to create clickable .app to launch your python scripts.

    Launch the Apple ScriptEditor (located in /Applications/Utilities/) and type in the following into the editor:

    tell application "Terminal"
        do script with command "python /path/to/your/script.py"
    end tell
    

    After, simply hit save and choose to save as an application.

    Ps.: If anyone reading this know how to get rid of the Terminal window that opens when you launch the .app, let me know.

    If you want to get more advanced, check out Platypus.

提交回复
热议问题