Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So, I've done the research, and i've done the try/catch process of almost getting things to work. . . almost.

I've read this chart: and i've read this post: How can I distribute a native executable for a Python program?

I'm at that point where I'm looking for either just using an installer that can run a python installer, then run the installers for all the dependencies (modules) or just copy paste the modules into the proper python directories.

So my question is: Do you have any experience with this? If so, what are your success/fail stories? Would you want to build everything into an Exe with something like pyinstaller, or just use a custom installer that would require more time to learn (like:

share|improve this question

closed as off-topic by Byte56 Mar 5 '15 at 18:47

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions about "how to get started," "what to learn next," or "which technology to use" are discussion-oriented questions which involve answers that are either based on opinion, or which are all equally valid. Those kinds of questions are outside the scope of this site. Visit our help center for more information." – Byte56
If this question can be reworded to fit the rules in the help center, please edit the question.

A completely different approach would be to run it in NaCL? Or in Javascript via ? This is not straightforward, and you'd be treading a new path, but it might make your target audience much much bigger? – Will Apr 18 '13 at 8:54
A single .exe is simpler for the user to use. – Crowbeak Apr 26 '13 at 5:45
Yes it is, which is why I now have one! – Eliot Leo Carney-Seim May 2 '13 at 19:40

You can just use py2exe. Congats.

share|improve this answer
The question was if you've had any experience or success with it, so do you? – Eliot Leo Carney-Seim Apr 18 '13 at 20:35
My experience with py2exe was that I could get it to work, but had to manually copy over some files it had missed. – Daniel Lubarov Apr 19 '13 at 4:08
I've had success! Please read my answer below. – Eliot Leo Carney-Seim May 2 '13 at 19:32

As mentioned on your links, pyInstaller has been a great tool so far because it attends what users usually want on a program: simplicity. With pyInstaller, you can put everything - compiled code and libraries - on a single file, and options like an icon to your executable. It's also multiplatform, which is a bonus these days. In fact, pyInstaller has many options for building your application, so you got the freedom to choose what's best for you.

share|improve this answer
Thanks for the response! See my answer to the question, i got it working! – Eliot Leo Carney-Seim May 2 '13 at 19:40
up vote 1 down vote accepted

I GOT IT WORKING!! I'm going to put all the info here that you need to know, as it's incredibly simple once you get it working.

First i'll explain my directory setup:

So i have: src\game\ in source, i have a music, graphics, game and data folder. I have all my .py files in the game folder, and the others are self explanatory. Also inside the source folder is a (RGB is the name of my game) and ALL THIS DOES is execute in the game folder. So it looks something like this: graphics> (images) games>,, src>music> (music) data> (log files and other stuff)

Now, PyInstaller 2.0 lets you use a .spec file, which you will HAVE to use to get this to work. I'll show mine, then explain it:

`# -*- mode: python -*-

import os
import glob
import sys

base_path = 'C:\\RGB\\dist\\RGBpy'
a = Analysis([os.path.join(base_path, '')],
             hiddenimports=['_codecs', 'encodings', 'encodings.aliases', 'encodings.codecs', 
             'encodings.encodings', 'encodings.__builtin__', 'encodings.utf_8'],
pyz = PYZ(a.pure)
exe = EXE(pyz,
          name=os.path.join('build\\pyi.win32\\RGB', 'RGB.exe'),
          console=True )

pygame_files = [
    ('freesansbold.ttf', os.path.join(base_path, 'data', 'freesansbold.ttf'), 'DATA'),

game_files = []
with file(os.path.join(base_path, '')) as f:
    for line in f.readlines():
        if line.startswith('include'):
            rest = line.split(' ')[1]
            base, pattern = os.path.split(rest)
            if base:
                for item in glob.glob(os.path.join(base_path, base, '*.*')):
                    _, name = os.path.split(item)
                        os.path.join(base, name),
coll = COLLECT(exe,
               a.datas + pygame_files + game_files,
               name=os.path.join('dist', 'RGB'))`

Now, your .tff file is likely to not be detected, so thats where the pygame_files list comes in. My .tff file is in the data folder, so the 'data' you see is there for that. Ignore the 'DATA' in all caps.

The C:\RGB\dist\RGBpy you see is where my is located and all the folders. I just renamed \src to \RGBpy. The location doesn't matter as long as the driver .py file ( is in that location, along with everything else that you'll probably want imported.

Next is game_files, this is used as a workaround for, which wouldn't work for me, but it might work for you, my file is just a .txt file with .in on the end and it has

exclude .hgignore
include graphics/*.*
include music/*.*
include game/*.*
include data/*.*
include *.py
include *.txt

which should be pretty self explanatory.

Additional details include a pathex which is where the .exe will be unloaded. Which, when combined with name=os.path.join('dist', 'RGB'), you get the .exe in RGB\dist\RGB.

The rest should be pretty self explanatory. To properly run it, save the in both the pysintaller main directory AND besides your ( and .spec in the pysintaller dir. Then execute the following in windows command: python pyinstaller .spec. If python isn't added to your system path:

ONE FINAL RULE THAT I MUST WARN YOU OF!! .pyc files. Pyinstaller will choose those of the exist. remove them before running pyinstaller!! It'll force your file imports to be static, causing all kinds of issues! That was my major roadblock several times. DELETE YOUR .PYC FILES!!

And that is all there is to it!! Good luck!!

(credit goes to paul paterson of for helping)

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.