Create a single-file executable using py2exe

newbieuser

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

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.

newbieuser

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.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

py2exe - Create single executable file out of a folder

From Dev

Building an executable file for python code using py2exe

From Dev

Using third-party library in py2exe single EXE file

From Dev

Creating single-instance exe using py2exe

From Dev

How to create .exe using py2exe(or pyinstaller) on Ubuntu

From Dev

To create a single executable jar file Maven

From Dev

Can we do file handling from executable created by py2exe in Python?

From Dev

PyInstaller/Py2exe - include os.system call with third party scripts in single file compilation

From Dev

PyInstaller/Py2exe - include os.system call with third party scripts in single file compilation

From Dev

Python: Is original source code viewable when converting a python script to .exe file using py2exe?

From Dev

Turning a py2exe setup.py file into one using cx_freeze

From Dev

How to create an EXE executable with batch file?

From Dev

How to create executable (.exe) file for any platform using Sikuli-script + Java + Eclips IDE

From Dev

"File not found" error with py2exe

From Dev

Py2Exe generate log file

From Dev

py2exe No such file or directory

From Dev

Python Flask - Building the Server as Executable (Py2exe)

From Dev

Py2exe executable shows black command line window

From Dev

Using py2exe in a virtualenv

From Dev

NameError when using py2exe

From Dev

Access denied using Py2exe

From Dev

Script with scipy using py2exe

From Dev

How to create an executable file for Linux machine using Pyinstaller?

From Dev

How to create a executable jar file using Maven and Netbeans

From Dev

Image is not displayed in pyside exe file by py2exe

From Dev

Create a command for a Linux executable file

From Dev

Create single Exe file from WPF project

From Dev

Py2exe, Tkinter, and Setup File Problems?

From Dev

Missing file in compiled py2exe app selenium

Related Related

  1. 1

    py2exe - Create single executable file out of a folder

  2. 2

    Building an executable file for python code using py2exe

  3. 3

    Using third-party library in py2exe single EXE file

  4. 4

    Creating single-instance exe using py2exe

  5. 5

    How to create .exe using py2exe(or pyinstaller) on Ubuntu

  6. 6

    To create a single executable jar file Maven

  7. 7

    Can we do file handling from executable created by py2exe in Python?

  8. 8

    PyInstaller/Py2exe - include os.system call with third party scripts in single file compilation

  9. 9

    PyInstaller/Py2exe - include os.system call with third party scripts in single file compilation

  10. 10

    Python: Is original source code viewable when converting a python script to .exe file using py2exe?

  11. 11

    Turning a py2exe setup.py file into one using cx_freeze

  12. 12

    How to create an EXE executable with batch file?

  13. 13

    How to create executable (.exe) file for any platform using Sikuli-script + Java + Eclips IDE

  14. 14

    "File not found" error with py2exe

  15. 15

    Py2Exe generate log file

  16. 16

    py2exe No such file or directory

  17. 17

    Python Flask - Building the Server as Executable (Py2exe)

  18. 18

    Py2exe executable shows black command line window

  19. 19

    Using py2exe in a virtualenv

  20. 20

    NameError when using py2exe

  21. 21

    Access denied using Py2exe

  22. 22

    Script with scipy using py2exe

  23. 23

    How to create an executable file for Linux machine using Pyinstaller?

  24. 24

    How to create a executable jar file using Maven and Netbeans

  25. 25

    Image is not displayed in pyside exe file by py2exe

  26. 26

    Create a command for a Linux executable file

  27. 27

    Create single Exe file from WPF project

  28. 28

    Py2exe, Tkinter, and Setup File Problems?

  29. 29

    Missing file in compiled py2exe app selenium

HotTag

Archive