把python脚本编译成二进制可执行文件。可以参考如下脚本使用,将脚本保存为switch.sh,执行 bash switch.sh pythonname.py 就可以生成pythonname可执行文件。
相比于使用pyinstaller, or py2exe,不需要安装额外包。生成的文件更小。而且方案跨平台通用。
参考:
build - Is there a way to compile a python application into static binary? - Stack Overflow