How to convert python .py file into an executable file for use cross platform?

前端 未结 4 619
礼貌的吻别
礼貌的吻别 2020-12-28 08:33

I\'ve been searching through SO for a while now trying to come up with an answer to this but due to my inexperience with programming I don\'t understand much of the document

4条回答
  •  醉梦人生
    2020-12-28 09:03

    Python scripts can be made directly executable, like shell scripts, by putting the python environment path in the top of the script file.

    #!/usr/bin/env python3.5 
    

    The Python installer automatically associates .py files with python.exe so that a double-click on a Python file will run it as a script. The extension can also be .pyw, in that case, the console window that normally appears is suppressed.

    Detailed description also for linux is here.

提交回复
热议问题