Задать вопрос
@brigar0
начинающий программист, подросток,знаю осн py и c#

Не могу добавить иконку через pyinstaller. Что делать?

Я хочу сделать из .py .exe с иконкой. иконка в формате .ico, но pyinstaller всё равно не нравиться иконка.
Ошибка
pyinstaller calcforCSV.py -F -i C:\Users\Public\Pictures\calc1.ico
298 INFO: PyInstaller: 5.4.1
298 INFO: Python: 3.10.6
339 INFO: Platform: Windows-10-10.0.19044-SP0
341 INFO: wrote C:\Users\psLes\OneDrive\Документы\py\calcforCSV.spec
343 INFO: UPX is not available.
346 INFO: Extending PYTHONPATH with paths
['C:\\Users\\psLes\\OneDrive\\Документы\\py']
837 INFO: checking Analysis
848 INFO: checking PYZ
857 INFO: checking PKG
859 INFO: Bootloader C:\Users\psLes\AppData\Roaming\Python\Python310\site-packages\PyInstaller\bootloader\Windows-64bit\run.exe
859 INFO: checking EXE
861 INFO: Rebuilding EXE-00.toc because calcforCSV.exe missing
861 INFO: Building EXE from EXE-00.toc
862 INFO: Copying bootloader EXE to C:\Users\psLes\OneDrive\Документы\py\dist\calcforCSV.exe.notanexecutable
872 INFO: Copying icon to EXE
Traceback (most recent call last):
  File "C:\Users\psLes\AppData\Roaming\Python\Python310\site-packages\PyInstaller\building\icon.py", line 50, in normalize_icon_type
    from PIL import Image as PILImage
ModuleNotFoundError: No module named 'PIL'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Program Files\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "c:\users\psles\appdata\roaming\python\python310\scripts\pyinstaller.exe\__main__.py", line 7, in <module>
  File "C:\Users\psLes\AppData\Roaming\Python\Python310\site-packages\PyInstaller\__main__.py", line 179, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "C:\Users\psLes\AppData\Roaming\Python\Python310\site-packages\PyInstaller\__main__.py", line 60, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "C:\Users\psLes\AppData\Roaming\Python\Python310\site-packages\PyInstaller\building\build_main.py", line 962, in main
    build(specfile, distpath, workpath, clean_build)
  File "C:\Users\psLes\AppData\Roaming\Python\Python310\site-packages\PyInstaller\building\build_main.py", line 884, in build
    exec(code, spec_namespace)
  File "C:\Users\psLes\OneDrive\Документы\py\calcforCSV.spec", line 24, in <module>
    exe = EXE(
  File "C:\Users\psLes\AppData\Roaming\Python\Python310\site-packages\PyInstaller\building\api.py", line 536, in __init__
    self.__postinit__()
  File "C:\Users\psLes\AppData\Roaming\Python\Python310\site-packages\PyInstaller\building\datastruct.py", line 173, in __postinit__
    self.assemble()
  File "C:\Users\psLes\AppData\Roaming\Python\Python310\site-packages\PyInstaller\building\api.py", line 641, in assemble
    icon.CopyIcons(build_name, self.icon)
  File "C:\Users\psLes\AppData\Roaming\Python\Python310\site-packages\PyInstaller\utils\win32\icon.py", line 207, in CopyIcons
    srcpath = normalize_icon_type(srcpath, ("exe", "ico"), "ico", config.CONF["workpath"])
  File "C:\Users\psLes\AppData\Roaming\Python\Python310\site-packages\PyInstaller\building\icon.py", line 54, in normalize_icon_type
    raise ValueError(
ValueError: Received icon image 'C:\Users\Public\Pictures\calc1.ico' which exists but is not in the correct format. On this platform, only ('exe', 'ico') images may be used as icons. If Pillow is installed, automatic conversion will be attempted. Please install Pillow or convert your 'ico' file to one of ('exe', 'ico') and try again.

иконка 512x512
6336ef8ba1e84900306895.ico
  • Вопрос задан
  • 409 просмотров
Подписаться 1 Простой Комментировать
Решения вопроса 1
Vindicar
@Vindicar
RTFM!
from PIL import Image as PILImage
ModuleNotFoundError: No module named 'PIL'


Please install Pillow or convert your 'ico' file to one of ('exe', 'ico') and try again.

ico бывают разные. Поставь пакет pillow.
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы