title: How to remove/exclude modules and files from pyInstaller?
body: <p>I'm trying to shrink the size of my python exe file, I've been looking around but I can't seem to find a good answer for removing extra modules. At the moment, I'm discovering that it's deleting modules I need instead of the ones I'm telling it to.  The documentation is rather unhelpful and neither are examples I've found so far.</p>
  
  <p>My spec file:</p>
  
  <pre><code>a = Analysis(['D:\\&lt;path&gt;\\&lt;scriptName&gt;.py'],
           pathex=['c:\\bin\\pyinstaller-2.0'],
           hiddenimports=[],
           hookspath=None,
           )
  
  pyz = PYZ(a.pure)
  exe = EXE(pyz,
        a.zipfiles,
        a.scripts,
        a.binaries,
        a.datas + [('data/Sounds/Cycle.wav', 'D:\\&lt;path&gt;\\data\\Sounds\\Cycle.wav','DATA'),
         ('data/Sounds/Hold.wav', 'D:\\&lt;path&gt;\\data\\Sounds\\Hold.wav','DATA'),
         ('data/Sounds/Timer.wav', 'D:\\&lt;path&gt;\\data\\Sounds\\Timer.wav','DATA'),
         ('data/Sounds/Warn.wav', 'D:\\&lt;path&gt;\\data\\Sounds\\Warn.wav','DATA'),
         ],
        name=os.path.join('dist', 'timer.exe'),
        debug=False,
        strip=False,
        upx=False,
        icon=r"D:\&lt;path&gt;\Icon.ico",
        console=True )
  </code></pre>
  
  <p>Now, I want to start excluding things, but there doesn't seem to be a very explanation of how to exclude things. </p>
  
  <p>These are things I had excluded when using py2exe:</p>
  
  <pre><code>'win32', 'unittest', _ssl, 'python25.dll', 'w9xpopen.exe', 'wx'
  'python25.dll', 'API*', 'KERNALBASE.dll', 'DEVOBJ.dll','CRMGR32.dll',
  'POWERPROF.dll', 'msvcm90.dll', 'msvcp90.dll', 'msvcr90.dll'
  </code></pre>
  
  <p>Though if I add any of these into the a.binaries as </p>
  
  <pre><code>a.binaries -[('wx')],
  </code></pre>
  
  <p>it deletes the PyQt4.dll files instead. Same holds true for the others. I do not follow that logic. I would think, at the very least, if it couldn't find them in the first place it would just skip over them instead of deleting other things.</p>
  
  <p>py2exe makes me a 26mb files + three files (exe, library.zip, and w9xpopen.exe)
  pyInstaller makes me an 11mb file, and one file.</p>
  
  <p>I feel I can make it smaller, but this excludes thing is confusing me.  It straight up ignores the msv dll files and puts them in anyway.</p>
  
  <p>Using Python 2.7, PyQt4 4.9.x</p>