py2exe不能用?

py2exe不能用?

正在学习各种python的工具和环境,在摸索py2exe
从py2exe.org下了最新的py2exe 0.65 for 2.4
我装的是pythone 2.4.3 for windows
装的过程没什么,自己找到了我装python的目录,然后无报错完毕。
按文档说明写了setup.py,然后运行是报错。

[Copy to clipboard] [ - ]
CODE:
C:\Python24$ python setup.py py2exe
C:\Python24\lib\distutils\dist.py:236: UserWarning: Unknown distribution option:
'console'
  warnings.warn(msg)
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: invalid command 'py2exe'

C:\Python24$ python setup.py py2exe --help
C:\Python24\lib\distutils\dist.py:236: UserWarning: Unknown distribution option:
'console'
  warnings.warn(msg)
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: invalid command 'py2exe'

setup.py怎么写的?
完全抄来的

[Copy to clipboard] [ - ]
CODE:
# setup.py
from distutils.core import setup
import py2exe
      
setup(console=["helloworld.py"])



[Copy to clipboard] [ - ]
CODE:
helloword.py
#!/usr/bin/env python
# Filename : helloworld.py
def main():
    print 'Hello World,你好'

if __name__ == '__main__':
    main()

你在哪个目录执行python setup.py py2exe的?
把setup.py和helloword.py挪到一个新目录(不要在C:\Python24下面),再试试。
果然,按楼上说的,是不能放在python24目录下,不过,还是出问题呀。

[Copy to clipboard] [ - ]
CODE:
C:\code$ python setup.py py2exe
Traceback (most recent call last):
  File "setup.py", line 3, in ?
    import py2exe
ImportError: No module named py2exe

C:\code$ python setup.py py2exe --help
Traceback (most recent call last):
  File "setup.py", line 3, in ?
    import py2exe
ImportError: No module named py2exe

C:\code$ dir

C:\code 的目录

2006-07-26  10:12    <DIR>          .
2006-07-26  10:12    <DIR>          ..
2006-07-25  10:54               137 helloworld.py
2006-07-25  15:34               101 setup.py
               2 个文件            238 字节
               2 个目录  2,098,184,192 可用字节

我很怀疑py2exe没有装好,我重装一遍好象还是这样。
ImportError: No module named py2exe

是没有装好
你是怎么安装的?python的版本?py2exe的版本?
第一楼写了,python 2.4.3        python-2.4.3.msi
py2exe0.65 for 2.4                 py2exe-0.6.5.win32-py2.4.exe
python2.4.3没有问题,我的不少.py测试代码都能用。
py2exe装的时候它自己找到我的C:\python24的目录,一路next就好了啊。
你在交互环境下试试import py2exe 行不行
Python 2.2.3 (#42, May 30 2003, 18:12:0 [MSC 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import py2exe
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ImportError: No module named py2exe
>>>

[Copy to clipboard] [ - ]
CODE:
Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.

    ****************************************************************
    Personal firewall software may warn about the connection IDLE
    makes to its subprocess using this computer's internal loopback
    interface.  This connection is not visible on any external
    interface and no data is sent to or received from the Internet.
    ****************************************************************
   
IDLE 1.1.3      
>>> import py2exe

Warning (from warnings module):
  File "C:\Python24\lib\distutils\dist.py", line 236
    warnings.warn(msg)
UserWarning: Unknown distribution option: 'console'

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in -toplevel-
    import py2exe
  File "C:\Python24\py2exe.py", line 5, in -toplevel-
  File "C:\Python24\lib\distutils\core.py", line 137, in setup
    raise SystemExit, gen_usage(dist.script_name) + "\nerror: %s" % msg
SystemExit: usage:  [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or:  --help [cmd1 cmd2 ...]
   or:  --help-commands
   or:  cmd --help

error: no commands supplied
>>>

我也试了一下安装py2exe 0.6
没有问题