在Python应用程序中嵌入Python解释器 [英] Embed Python interpreter in a Python application
问题描述
我正在寻找一种将Python解释器与我的应用程序一起交付的方法(也用Python编写),这样就不需要在计算机上安装Python。
I'm looking for a way to ship the Python interpreter with my application (also written in Python), so that it doesn't need to have Python installed on the machine.
我搜索了Google,发现了大量关于如何将Python解释器嵌入以各种语言编写的应用程序中的结果,但是对于以Python本身编写的应用程序则没有任何结果...我不需要隐藏我的代码或制作像 cx_freeze
这样的二进制文件,我只是不想让用户必须安装Python才能使用我的应用程序,仅此而已。
I searched Google and found a bunch of results about how to embed the Python interpreter in applications written in various languages, but nothing for applications written in Python itself... I don't need to "hide" my code or make a binary like cx_freeze
does, I just don't want my users to have to install Python to use my app, that's all.
推荐答案
要在Windows计算机上分发,请查看 py2exe
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
对于MacIntosh,有 py2app (但我不熟悉)
For the MacIntosh, there is py2app (but I'm not familiar with it)
对于Windows和Linux,都有 bbfreeze 或 pyinstaller
And for both Windows and Linux, there's bbfreeze or also pyinstaller
这篇关于在Python应用程序中嵌入Python解释器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!