'Pyinstaller on Windows versus Mac and why doesn't the correct icon appear on the Windows version?
I'm using a Mac with OS 11.6.1 and running Windows 10 on the Mac with VMware Fusion. I've used Pyinstaller in both environments to create a simple .app and .exe, respectively. I have one specific question and one general question that I'm seeking assistance on:
Question 1:
In my .spec file for the Mac version, I included
icon='/Users/MyName/Desktop/myicon.ico'as a parameter inapp=BUNDLE. Everything worked fine and the icon appeared as desired.When I tried the same thing in the Windows version, using // instead of /, my icon did not appear as I wanted. This was true regardless of whether I included the .ico in
datas.
For the sake of thoroughness, here's the complete .spec file:
block_cipher = None
a = Analysis(['my_program.py'],
pathex=[],
binaries=[],
datas=[('C:\\Users\\my_icon.ico','.')],
hiddenimports=[],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
[],
exclude_binaries=True,
name='my_program',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=False,
disable_windowed_traceback=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None )
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
upx_exclude=[],
icon='C:\\Users\\my_icon.ico',
name='my_program')
I'm wondering why this doesn't produce the desired icon. Could this be the nature of my icon itself? I simply went online and found a site that converted a .png to .ico and .icns.
Question 2:
When using Pyinstaller on my Mac versus on Windows, I've observed a different folder structure for the results. Both programs are contained in dist, but things are organized differently.
If I'm creating "my_program" the structure is as follows, where "<" means "is contained in."
Mac: my_program.app < dist as well as my_program folder < dist but the app and the my_folder are separate. (The folder contains many things, such as numpy.)
Windows: my_program.exe < my_program folder < dist
Is this the correct way things are organized? I've noticed that I can't open my_program.exe after it's moved to the desktop, which makes me wonder if I'm missing something.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
