使用Pyinstaller编译的应用无法在其他计算机上启动(OSError:dlopen()无法加载库)

时间:2018-10-24 04:48:05

标签: python macos pyinstaller cairo software-distribution

我正在使用python 3.7为MacOS开发一个小型应用程序。我用Homebrew安装了python。我用PyInstaller编译了应用程序。该应用程序利用了PyInstaller似乎不喜欢的外部库,例如cairosvg和python-docx。通过将cairosvg和docx文件夹从它们各自的站点包文件夹移至应用程序分发版,我设法使其在我的计算机上正常工作。

当我在计算机(MacOS High Sierra 10.13.6)上运行该应用程序时,它可以工作。当我的客户端在计算机上运行它(MacOS High Sierra 10.13.5)时,它崩溃了。我要求他们在终端中运行它以获取错误消息,这是他们得到的内容:

Last login: Sat Oct 6 07:05:44 on console
Andrews-MacBook-Pro-3:~ perryand$ /Users/perryand/Downloads/PGN\ to\ docx/dist/main.app/Contents/MacOS/main ; exit;
Traceback (most recent call last):
File "main.py", line 14, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "/usr/local/lib/python3.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 627, in exec_module
File "cairosvg/init.py", line 41, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "/usr/local/lib/python3.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 627, in exec_module
File "cairosvg/surface.py", line 24, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "/usr/local/lib/python3.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 627, in exec_module
File "cairocffi/init.py", line 41, in <module>
File "cairocffi/init.py", line 38, in dlopen
OSError: dlopen() failed to load a library: cairo / cairo-2 / cairo-gobject-2
[15441] Failed to execute script main
logout
Saving session...
...saving history...truncating history files...
...completed.
Deleting expired sessions...none found.

[Process completed]

似乎cairosvg库无法加载。我的机器上没有此错误。对于开罗来说,我的发行版中没有包含我不重要的内容吗?据我了解,PyInstaller不会复制非常规文件,但是它也不能在我的机器上运行。我在没有安装任何软件的virtualenv中对其进行了测试,它可以正常工作并且不会产生任何错误。我有点迷茫。

0 个答案:

没有答案