Embed python interpreter in a python application

99封情书 提交于 2019-12-03 14:38:46

For distribution on Windows machines, look into py2exe

py2exe is a Python Distutils extension which converts Python scripts 
into executable Windows programs, able to run without requiring a 
Python installation

For the MacIntosh, there is py2app (but I'm not familiar with it)

And for both Windows and Linux, there's bbfreeze or also pyinstaller

You need some sort of executable in order to start Python. May as well be the one your app has been frozen into.

The alternative is to copy the executable, library, and pieces of the stdlib that you need into a private directory and invoke that against your app.

Making a frozen binary using a utility like cx_freeze or py2exe is probably the easiest way to do this. That way you only need to distribute the executable. I know that you might prefer not to distribute a binary, but if that is a concern you could always give users the option to download the source and run from an interpreter.

For Windows: py2exe

For Linux: Freeze

Full disclosure: I've only read about these, never used them. Perhaps some who has can comment?

Have a look at http://www.python-packager.com, it is a free webservice for building redistrutable python binaries based on pyinstaller. I've used it to build apps for Windows and it is very easy to use and also works with GUI apps.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!