cx_Freeze and Python 3.3
Question: So, I have some Python 3.3 code that I need to make an .exe from on Windows. I
discovered the only way to do it is using cx_Freeze. But, I haven't even got
further than installation. This question describes my problem perfectly
(except I run Python 3.3), and has not been answered yet:

[installing/using
cx_freeze](http://stackoverflow.com/questions/13906343/installing-using-cx-
freeze)

When I try to run "python setup.py build" from cmd I get:

    
    
    "importerror: no module named cx_freeze" 
    

I can't get past this step, and have searched for a solution for an hour
unsuccessfully.

In case it's relevant Python is installed at C:\Python33. Both Python and
cx_Freeze I installed are 64-bit versions. Version of cx_Freeze I installed
was: cx_Freeze-4.3.1.win-amd64-py3.3. I tried reinstalling. When I do "import
cx_Freeze" in IDLE, it doesn't show any errors.

Please also note I'm a programming beginner.


Answer: Answer to the question is in my other answer. Make sure you read it first as
this one expands on it.

Ok, so after a few more hours of pain I got my game to run as an .exe on
computers of people who don't have Python installed, which was my goal! I was
using Pygame to make the game if anyone needs to know.

So, here's shortly what I did after the step in the other answer I gave:

This is the setup.py I used:

    
    
    from cx_Freeze import setup, Executable
    
    includefiles = ['add_all_your_files_here, example.png, example.mp3']
    includes = []
    excludes = []
    packages = []
    
    setup(
        name = 'yourgame',
        version = '1.0.0',
        description = '',
        author = 'John Doe',
        author_email = 'johndoe@gmail.com',
        options = {'build_exe': {'excludes':excludes,'packages':packages,'include_files':includefiles}}, 
        executables = [Executable('yourgame.py')]
    )
    

Note that I couldn't figure (and didn't want to bother) about how to include
files from other folders, so I put them all together where the setup.py was. I
tried putting the relative path, but seems like I should've put the absolute.

To notice what files were missing I had to run the exe from cmd so when it
would crash I could read what was the error. This wasn't possible to do when I
opened the .exe from Windows because the window would close too fast.

Other than files that my code required, it also wanted some other .py files.
Namely:

    
    
    re.py
    sre_compile.py
    sre_constants.py
    sre_parse.py
    

I copied them from python (c:\Python33\Lib) to my game folder.

The .exe was then able to run my game without problems on my and another
computer that doesn't have python installed (no font problems for example, as
I heard some people have).

I've spent 9 hours in two days to figure all this out. Hope it helps other
beginners.

