启动应用程序时 Py2App PIL 图像错误

2024-01-01

我正在使用 py2app 将 python 文件转换为应用程序,但遇到了此错误:

Traceback (most recent call last):
  File "/Users/MYUSER/PycharmProjects/webstuff/BotTest/dist/ws1.app/Contents/Resources/__boot__.py", line 87, in _recipes_pil_prescript
    import Image
ModuleNotFoundError: No module named 'Image'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/MYUSER/PycharmProjects/webstuff/BotTest/dist/ws1.app/Contents/Resources/__boot__.py", line 132, in <module>
    _recipes_pil_prescript(['ImtImagePlugin', 'XpmImagePlugin', 'FtexImagePlugin', 'McIdasImagePlugin', 'MpegImagePlugin', 'SpiderImagePlugin', 'DdsImagePlugin', 'FpxImagePlugin', 'MspImagePlugin', 'XVThumbImagePlugin', 'GbrImagePlugin', 'MpoImagePlugin', 'BmpImagePlugin', 'BlpImagePlugin', 'IptcImagePlugin', 'PpmImagePlugin', 'JpegImagePlugin', 'SgiImagePlugin', 'PalmImagePlugin', 'PsdImagePlugin', 'ImImagePlugin', 'MicImagePlugin', 'BufrStubImagePlugin', 'WebPImagePlugin', 'FliImagePlugin', 'TgaImagePlugin', 'PixarImagePlugin', 'TiffImagePlugin', 'CurImagePlugin', 'PngImagePlugin', 'FitsStubImagePlugin', 'Hdf5StubImagePlugin', 'DcxImagePlugin', 'IcnsImagePlugin', 'EpsImagePlugin', 'GifImagePlugin', 'SunImagePlugin', 'WmfImagePlugin', 'GribStubImagePlugin', 'PcdImagePlugin', 'IcoImagePlugin', 'XbmImagePlugin', 'PdfImagePlugin', 'PcxImagePlugin', 'Jpeg2KImagePlugin'])
  File "/Users/MYUSER/PycharmProjects/webstuff/BotTest/dist/ws1.app/Contents/Resources/__boot__.py", line 90, in _recipes_pil_prescript
    from PIL import Image
  File "PIL/Image.pyc", line 64, in <module>
  File "PIL/_imaging.pyc", line 14, in <module>
  File "PIL/_imaging.pyc", line 10, in __load
  File "imp.pyc", line 342, in load_dynamic
ImportError: dlopen(/Users/MYUSER/PycharmProjects/webstuff/BotTest/dist/ws1.app/Contents/Resources/lib/python3.7/lib-dynload/PIL/_imaging.so, 2): Library not loaded: @loader_path/.dylibs/libjpeg.9.dylib
  Referenced from: /Users/MYUSER/PycharmProjects/webstuff/BotTest/dist/ws1.app/Contents/Resources/lib/python3.7/lib-dynload/PIL/_imaging.so
  Reason: image not found

错误发生后,程序终止。程序中使用的所有图像都通过设置中的 data_files 包含在其中。我的代码有错误还是与 py2app 有关?


In your

python setup.py py2app

or

python3 setup.py py2app

包括旗帜--packages=PIL

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

启动应用程序时 Py2App PIL 图像错误 的相关文章

随机推荐