1

I'm trying to make pythonmain.py a executable file using pyinstaller, and I want to add an icon to it;

I tried to add the logo01 png file as the icon option but I still got a file with the default logo:

$ pyinstaller --icon=logo01.png pythonmain.py

 

the file still had the default icon,

file: enter image description here

update:

I converted the .png to .ico file as suggested in the comments:

enter image description here

$ pyinstaller --icon=logo01.ico pythonmain.py

it deleted the previous folder and made a new executable file, but still with the same default icon;

(file kind is Unix Executable)

coder_not_found
  • 202
  • 2
  • 13
  • 1
    I think you need an ico file. Also maybe that would help: https://stackoverflow.com/questions/29291113/pyinstaller-setting-icons-dont-change – David Meu Mar 22 '21 at 08:39
  • 2
    Try: ```pyinstaller --onefile --icon=logo01.ico pythonmain.py``` – David Meu Mar 22 '21 at 08:54
  • @David Meu when I add the option --one file I get a permission error: PermissionError: [Errno 1] Operation not permitted: – coder_not_found Mar 22 '21 at 09:45
  • Try removing all files and rerun. Or change dir permissions (Or run it with sudo). https://stackoverflow.com/questions/55437879/pyinstaller-permissionerror-errno-1-operation-not-permitted-users-user-nam – David Meu Mar 22 '21 at 09:57
  • @David Meu using --onefile worked after I deleted the dist, but still the same default icon is on the file, is there another way to change the icon manually or – coder_not_found Mar 22 '21 at 10:20
  • Maybe it's the file not sure. Try also with --windowed option. Try some ico file from here: https://iconarchive.com/tag/linux-.ico Are you sure ico file exist? – David Meu Mar 22 '21 at 10:22
  • the .ico file is located in the same folder as the main file. as in the screenshot above^ – coder_not_found Mar 22 '21 at 10:28
  • do I need to add the absolute path to the .ico or just the name with the extension because its in the same folder – coder_not_found Mar 22 '21 at 10:33
  • just the name with the extension because its in the same folder – David Meu Mar 22 '21 at 10:35
  • seems like it is a discussed issue for linux (see last): https://github.com/pyinstaller/pyinstaller/issues/2714 – David Meu Mar 22 '21 at 10:43
  • seems it can't be done in linux. https://stackoverflow.com/questions/62094087/how-to-attach-icon-to-executable-using-pyinstaller-in-archlinux – David Meu Mar 22 '21 at 10:54
  • if it doesn't work on Mac also then I think I should try another installer – coder_not_found Mar 22 '21 at 10:55
  • Oh, If you are using mac try icns file. As you can see in docs there is only refrence for: windows/mac https://pyinstaller.readthedocs.io/en/stable/usage.html – David Meu Mar 22 '21 at 10:58
  • I converted my icon file to .icns and tried and I used a file from https://iconarchive.com/tag/mac-icns but still the default icon is on the file. :( – coder_not_found Mar 22 '21 at 11:23

0 Answers0