Create a single-file executable using py2exe
Question: I have written a python code which displays a window using Tkinter. It also
calls another python file present in the same folder. I converted the .py
files into a .exe file using py2exe. But i am facing the below issues:

  1. The output (in dist folder) is a set of files and not a single executable file.

     * As per my understanding using the `'bundle_files':1,'compressed':True`, i should be getting a single file.
     * Now i have two .exe files and 1 folder: **w9xpopen.exe,myframe.py**(this is my file) and folder "**tcl** " 
  2. The icon is not changed.

     * I had mentioned `"icon_resources":[(0,"icon.ico")]` in the "windows" section

Below is the **setup.py** i used:

    
    
    from distutils.core import setup
    import py2exe, glob,sys,os
    
    sys.argv.append('py2exe')
    
    setup(
    
      options={'py2exe':{'bundle_files':1,'compressed':True}},
      windows=[{"script":'hr_data_downloader.py',"icon_resources":   [(0,"icon.ico")]}],
     data_files = [],
     zipfile=None
    )
    

I had issues running the executable at first but after going through the below
posts, i corrected it by explicitly adding the two dlls.

[Creating single EXE using py2exe for a Tkinter
program](http://stackoverflow.com/questions/14975018/creating-single-exe-
using-py2exe-for-a-tkinter-program)

[py2exe - generate single executable
file](http://stackoverflow.com/questions/112698/py2exe-generate-single-
executable-file)

Please let me know if it is possible to create a single-file executable by
modifying the setup files or any other py2exe files. Also please tell me why
the icon is not shown for the created .exe

I am open to try other distribution utilities like py2exe if it can help me
create single-file executable.


Answer: I figured out how to do it using pyinistaller. Although it makes the exe
considerably large, i am happy that i have only single file.

Below is what i did:

  1. Installed pyinstaller, pywin32
  2. Open command prompt
  3. go to my code folder
  4. use command `pyinstaller --onefile --windowed myframe.py`

The manual for pyinstaller has detailed explanations.

