Python 3.2.2,错误(exe脚本)

use*_*624 2 python executable

您好我按照这个说明(如何使用py2exe将python3.2的代码更改为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
Run Code Online (Sandbox Code Playgroud)

这是我的setup.py文件:

from cx_Freeze import setup, Executable
setup(
    name = "Ochranka",
    version = "1.0",
    description = "test",
    executables = [Executable("ochranka.py")])
Run Code Online (Sandbox Code Playgroud)

我是初学者,我不知道该怎么做.

Jon*_*ric 5

你必须传递一个命令setup.py; 在这种情况下,build*:

python setup.py build
Run Code Online (Sandbox Code Playgroud)

我打赌你忘记了那build部分.

*注意:我不是100%确定build你想要的命令(因为我使用了cx_freeze已经有一段时间了).请参阅文档.