Compiling .py-file to .exe in Python 3.3
Question: I can't figure get py2exe working.

I wish to convert this test.py to test.exe:

test.py code:

    
    
    print("Hello World!")
    

**EDIT:**

Apparently I used python 2.x approach. When I instead used the 3.3 command:

    
    
     py -3.3 -m py2exe.build_exe test.py
    

I got the new error:

    
    
     D:\program\python\lib\distutils\dist.py:257: UserWarning: Unknown     distribution o
     ption: 'console'
     warnings.warn(msg)
     invalid command name 'test.py'
    

Feels as if I am just running into walls constantly. Any insight on this new
error?

**Old part of post:**

I have created a setup.py with the following code:

    
    
    from distutils.core import setup
    import py2exe
    
    setup(console=['test.py'])
    

I installed py2exe (ver 0.9.2.2) with pip. When I move to the folder
containing setup.py and test.py and run the command:

    
    
    python setup.py py2exe
    

I run into the error:

    
    
     D:\program\python\lib\distutils\dist.py:257: UserWarning: Unknown distribution o
     ption: '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'
    


Answer: The python documentation discourages the use of the `distutils` module.
Instead use `setuptools` as follows

    
    
    from setuptools import setup
    import py2exe
    
    setup(scripts=['test.py'])
    

Under python 3 though, you can't use `py2exe` see the
[FAQ](https://docs.python.org/3/faq/windows.html?#how-do-i-make-an-executable-
from-a-python-script) for details.

