简体   繁体   English

如何使用cx_freeze生成可执行文件?

[英]How to make an executable with cx_freeze?

I making an executable with python 2.6. 我使用python 2.6制作了可执行文件。 I made the setup code. 我做了安装代码。

import sys
from cx_Freeze import setup, Executable

base = None
if sys.platform == "win32":
    base = "Win32GUI"

setup(
    name = "Aimball",
    version = "2.6",
    description = "Aimball Game",
    executables = [Executable("aimball.py", base = base)])

Then what do I do? 那我该怎么办? I have read the cx_freeze documentation and other answers but not sure what they exactly mean. 我已经阅读了cx_freeze文档和其他答案,但不确定它们的确切含义。 Could someone explain it clearer as I just started programming in Python a few weeks ago. 几周前我刚开始使用Python编程时,有人可以更清楚地解释它。 Just in case I'm running Windows 7 and version 4.3.1 of cx_freeze with Python 2.6. 以防万一我正在运行Windows 7和cx_freeze的4.3.1版本以及Python 2.6。

Save that file in the same folder as your aimball.py script, as something like setup.py . 将该文件保存为与aimball.py脚本相同的文件夹,例如setup.py Then open up a command prompt in that directory (you can use the cd command to Change Directory). 然后在该目录中打开命令提示符(您可以使用cd命令更改目录)。 Then run python setup.py build . 然后运行python setup.py build If it works, it should create a build/exe... folder containing your executable and some other files it needs to run. 如果可行,它将创建一个build/exe...文件夹,其中包含您的可执行文件和其他需要运行的文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM