PyInstaller cannot change shortcut icon

My problem is this: I can install any icon that I like in the executable file itself, I cannot change this

enter image description here

I tried everything, but when I select an exe file or when I create a shortcut, this PyInstaller icon will appear!

This is what exe looks like

enter image description here

Here's the tricky part; it will NOT happen if I set the --onefile option. If I create a standalone exe, this “extra” unwanted icon will disappear!

and here is the specified file if you need it:

# -*- mode: python -*-
a = Analysis(['Backpack.py'],
             pathex=['C:\\Users\\Angelo\\Desktop\\PyInstaller-2.1\\Backpack'],
             hiddenimports=[],
             hookspath=None,
             runtime_hooks=None)

a.datas += [('back_ico_3.ico', 'C:\\Users\\Angelo\\Desktop\\PyInstaller-2.1\\back_ico_3.ico', 'DATA')]

pyz = PYZ(a.pure)
exe = EXE(pyz,
          a.scripts,
          exclude_binaries=True,
          name='Backpack.exe',
          debug=False,
          strip=None,
          upx=True,
          console=False , icon='back_ico_3.ico')
coll = COLLECT(exe,
               a.binaries,
               a.zipfiles,
               a.datas,
               strip=None,
               upx=True,
               name='Backpack')
+4
source share
2 answers

I had the same problem even when using --onefile. Cutting and pasting .exe into a new directory worked.

IconCache.db , . %localappdata%.

+2

:

exe = EXE(pyz,
      a.scripts,
      exclude_binaries=True,
      name='Backpack.exe',
      debug=False,
      strip=None,
      upx=True,
      console=False , icon='C:\\Users\\Angelo\\Desktop\\PyInstaller-2.1\\back_ico_3.ico')
0

Source: https://habr.com/ru/post/1545655/


All Articles