Skip to content Skip to sidebar Skip to footer

Pyinstaller Exe Not Working When I Change The Icon

I was making a GUI with python Tkinter. It also uses numpy and matplotlib also. So, I used pyinstaller and make a exe out of the python script. It runs flawlessly and did all what

Solution 1:

For those still experiencing this issue, I found that pointing the iconbitmap line to the full path will resolve the issue. I was originally having the same problem as the original poster until I entered the full path to my .ico file.

Example:

wm_iconbitmap('E:\icon_name.ico')

Solution 2:

try setting datas like:

a.datas += [('C:\\Users\\KoushikNaskar\\Desktop\\Python\\image.ico', 'image.ico')]

from: http://pythonhosted.org/PyInstaller/spec-files.html#adding-data-files

datas is a list of tuples: (source, dest)

Solution 3:

Your problem (most likely) is that you are not bundling the icon's image when using pyinstaller to compile your program to a .exe.

You'll see something like this in your .spec file:

a = Analysis(['your_script.py'],
         pathex=['your_path'],
         binaries=None,
         datas=['file_1_path', ....], # Herehiddenimports=[],
         hookspath=[],
         runtime_hooks=[],
         excludes=[],
         win_no_prefer_redirects=False,
         win_private_assemblies=False,
         cipher=block_cipher)

Or you could do something like

a.datas += [item1, item2, ...]

Post a Comment for "Pyinstaller Exe Not Working When I Change The Icon"