python 创建单个python可执行模块

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1999129/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-03 23:31:45  来源:igfitidea点击:

Create single python executable module

pythonlinuxwinapiexecutable

提问by yart

Guys, I have much python code in modules which are resides in several python packages and now I need to create single python executable module or file which will include all these files, so it will be working on windows and on linux servers. What are possible solutions and how this can be done?

伙计们,我在模块中有很多 python 代码,它们驻留在多个 python 包中,现在我需要创建单个 python 可执行模块或文件,其中将包含所有这些文件,因此它将在 windows 和 linux 服务器上运行。什么是可能的解决方案以及如何做到这一点?

采纳答案by S.Lott

回答by Anurag Uniyal

For windows use py2exe, for linux use pyinstallerand for Mac use py2app

windows 使用py2exe,linux 使用pyinstaller,Mac 使用py2app

Using these tools you can have a setup.pywhich based on os will build the final binary.

使用这些工具,您可以使用setup.py基于 os 的工具来构建最终的二进制文件。

I have tried all three and they work well, or you can use cx_freezethey claim to be cross-platform

我已经尝试了所有三个并且它们运行良好,或者您可以使用他们声称是跨平台的cx_freeze

回答by miku

Maybe py2execan help you ..

也许py2exe可以帮助你..

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

py2exe 是 Python Distutils 扩展,可将 Python 脚本转换为可执行的 Windows 程序,无需安装 Python 即可运行。

Tutorial > http://www.py2exe.org/index.cgi/Tutorial

教程 > http://www.py2exe.org/index.cgi/Tutorial

回答by Arshid KV

You can kivyfor python cross plat form application .

你可以kivyfor python 跨平台应用程序。

Kivy - Open source Python library for rapid development of applications that make use of innovative user interfaces, such as multi-touch apps

Kivy - 开源 Python 库,用于快速开发利用创新用户界面的应用程序,例如多点触控应用程序