如何使用cx_freeze? [英] How do I use cx_freeze?
本文介绍了如何使用cx_freeze?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经按照说明创建了setup.py文件,但实际上我没有..了解下一步该怎么做。在命令行中键入 python setup.py build只会出现语法错误。
I've created my setup.py file as instructed but I don't actually.. understand what to do next. Typing "python setup.py build" into the command line just gets a syntax error.
那么,我该怎么办?
setup.py:
from cx_Freeze import setup, Executable
setup(
name = "On Dijkstra's Algorithm",
version = "3.1",
description = "A Dijkstra's Algorithm help tool.",
exectuables = [Executable(script = "Main.py", base = "Win32GUI")])
推荐答案
- 添加
import sys
作为新标题 - 您在最后一行中拼写了可执行文件。
- 删除最后一行的
script =
。 - Add
import sys
as the new topline - You misspelled "executables" on the last line.
- Remove
script =
on last line.
代码现在应如下所示:
import sys
from cx_Freeze import setup, Executable
setup(
name = "On Dijkstra's Algorithm",
version = "3.1",
description = "A Dijkstra's Algorithm help tool.",
executables = [Executable("Main.py", base = "Win32GUI")])
使用命令提示符( cmd
)运行 python setup.py build
。 (从包含 setup.py
的文件夹中运行此命令。)请注意,我们在末尾添加的 build
参数。脚本调用。
Use the command prompt (cmd
) to run python setup.py build
. (Run this command from the folder containing setup.py
.) Notice the build
parameter we added at the end of the script call.
这篇关于如何使用cx_freeze?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文