您好,我按照此说明( How can I use the py2exe to change the python3.2's code to exe )创建 exe 形式的 python 脚本(版本 3.2.2),但它报告我一个错误:
Traceback (most recent call last):
File "C:\Python32\Scripts\setup.py", line 7, in <module>
executables = [Executable("ochranka.py")])
File "C:\Python32\lib\site-packages\cx_Freeze\dist.py", line 365, in setup
distutils.core.setup(**attrs)
File "C:\Python32\lib\distutils\core.py", line 136, in setup
raise SystemExit(gen_usage(dist.script_name) + "\nerror: %s" % msg)
SystemExit: usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: no commands supplied
这是我的 setup.py 文件:
from cx_Freeze import setup, Executable
setup(
name = "Ochranka",
version = "1.0",
description = "test",
executables = [Executable("ochranka.py")])
我是个初学者,不知道该怎么办。
最佳答案
您必须将命令传递给setup.py
;在本例中,构建
*:
python setup.py build
我打赌你忘记了build
部分。
*注意:我不能 100% 确定 build
是您想要的命令(自从我使用 cx_freeze 以来已经有一段时间了)。请参阅the documentation .
关于Python 3.2.2,错误(脚本到exe),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14820461/