How to add an Icon to Pyinstaller EXE

In this Python Pyinstaller tutorial we will demonstrate how to add an Icon to a Pyinstaller EXE (file). The default icon does not give your application a very good look. It’s much better to use a customized Icon which matches your application. Even a simple Python Icon would be a good choice.


Add an Icon to a Pyinstaller file

All you really need to do is pass in a single extra option to your regular pyinstaller command. Here is a example command, where we added the option ‘–icon’. You can either assign a file name or file path to this option (depending on where your python file and icon are located).

pyinstaller --icon=andriod.ico add_icon.py

You should now see the following output (or something similar depending on your OS)

How to add an Icon to Pyinstaller EXE

As you can see, the icon has now replaced the default pyinstaller icon. Success!

Here are some sample icons for you guys to use.

Sample Icons (930 downloads)

Windows Users

For those of you on windows, you are likely to face this weird issue where the Icon just does not show up, even after running the above command successfully. I believe it has something to do with the cache system for Icons in Windows (you can look this up, and how to refresh it).

An easy way of resolving this issue is to “copy” the EXE, and paste it again in the same directory. It will now have the new Icon. Delete the old EXE, rename the new one and you are done!


For Auto-py-to-GUI users

If anyone here is using auto-py-to-gui, you can find the Icon option here (the area marked in red). Copy paste the file path to your icon in there, and then continue as you normally would.


This marks the end of the “How to add an Icon to Pyinstaller EXE” Tutorial. Any suggestions or contributions for CodersLegacy are more than welcome. Questions regarding the tutorial content can be asked in the comments section below.

Subscribe
Notify of
guest
1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments