使用pyinstaller时,是否可以在Mac OSX上手动替换或指定.dylib的位置?
我在尝试打开已完成的.app
时收到错误消息Traceback (most recent call last):
File "DeepMeerkat/main.py", line 3, in <module>
import cv2
File "/Library/Python/2.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 546, in load_module
module = imp.load_module(fullname, fp, filename, ext_tuple)
ImportError: dlopen(/Users/ben/Documents/DeepMeerkat/Installer/dist/Lib/cv2.so, 2): Library not loaded: @loader_path/libpng16.16.dylib
Referenced from: /Users/ben/Documents/DeepMeerkat/Installer/dist/Lib/libopencv_imgcodecs.3.3.dylib
Reason: Incompatible library version: libopencv_imgcodecs.3.3.dylib requires version 48.0.0 or later, but libpng16.16.dylib provides version 45.0.0
Failed to execute script main
我在应用程序外部的python中加载cv2或者使用自制软件安装的open的任何其他问题都没有问题。
我认为,当需要从Homebrew的文件夹(/opt/X11/include/libpng16
)中抓取时,错误来自于pyinstaller从X11(/usr/local/Cellar/libpng/1.6.32/
)抓取libpng的错误。
如何使用钩子指定我想要的libpng?
答案 0 :(得分:0)
我遇到了同样的问题,答案在于编辑.spec文件。在= Analysis ...:
之后添加以下行a.binaries = a.binaries - TOC([('libpng16.16.dylib',None,None)])
这样可以从相关的TOC文件中删除有问题的dylib,从而解决冲突。