py2exe exe closes immediately after launch py2exe exe closes immediately after launch tkinter tkinter

py2exe exe closes immediately after launch


AFAIK, py2exe leaves some DLLs behind. They should be copied manually into your dist directory. I would suggest running your compilation through Dependency Walker to find out what Dlls are missing.

http://www.dependencywalker.com/

5.2. Python 2.6, 2.7, 3.0, 3.1

For Python 2.6, the DLL you need is called MSVCR90.dll. Py2exe is not able to automatically include this DLL in your dist directory, so you must provide it yourself.

To complicate things, there is more than one version of this DLL in existance, each with the same filename. You need the same version that the Python interpreter was compiled with, which is version 9.0.21022.8. Through the remainder of these instructions, hover your mouse over the dll file (or the vcredist_x86.exe installer executable) to confirm which version you've got. You'll need the vcredist_x86.exe that contains the Microsoft Visual C++ 2008 Redistributable Package published 29-11-2007, so not the VS2008 SP1 one (tested with Python 2.7.1).

http://www.py2exe.org/index.cgi/Tutorial


Try using the 'setup.py' code below. You exclude the dll file that causes the error and you also have to import the sip module.

from distutils.core import setupimport py2exe

setup(console=['hello.py'],    options = {            "py2exe": {                "dll_excludes": ["MSVCP90.dll"],                 "includes":["sip"]            }        },)

In order to see what's the problem, run your exe file from terminal.