First time using pyinstaller, I ran pyinstaller appname.py --icon='myicon.ico' The icon file is converted using convertico.com and it is at the same directory where I ran pyinstaller
In dist/appname/ directory, the executable appname icon is still not changed. Did I do something wrong? The spec file is:
# -*- mode: python -*-
block_cipher = None
a = Analysis(['appname.py'],
pathex=['/home/admin/appname'],
binaries=None,
datas=None,
hiddenimports=[],
hookspath=None,
runtime_hooks=None,
excludes=None,
win_no_prefer_redirects=None,
win_private_assemblies=None,
cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
exclude_binaries=True,
name='appname',
debug=False,
strip=None,
upx=True,
console=True , icon='myicon.ico')
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=None,
upx=True,
name='appname')
It has worked, just a problem with cached icons. If you move the .exe
to another folder the icon should change. Just to be sure though rebuild using :
pyinstaller --onefile --icon=myicon.ico --clean yourapp.py
The --clean
command cleans the cache and your icon will appear correctly
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With