Ber*_*ard 7 python macos pyinstaller
我正在 MacOS BigSur 上使用 pyinstaller 构建游戏。它构建正确,但失败并出现“libpython3.9.dylib”“找不到图像”错误(下面是完整错误)
pyinstaller 构建应用程序后,我运行它:dist/gralli_quest.app/Contents/MacOS/gralli_quest
这是启用调试后的输出:
[22699] PyInstaller Bootloader 3.x
[22699] LOADER: executable is /Users/bernard/projects/gralli_quest/dist/gralli_quest.app/Contents/MacOS/gralli_quest
[22699] LOADER: homepath is /Users/bernard/projects/gralli_quest/dist/gralli_quest.app/Contents/MacOS
[22699] LOADER: _MEIPASS2 is NULL
[22699] LOADER: archivename is /Users/bernard/projects/gralli_quest/dist/gralli_quest.app/Contents/MacOS/gralli_quest
[22699] LOADER: Cookie found at offset 0x17CD99D2
[22699] LOADER: Extracting binaries
[22699] LOADER: Executing self as child
[22699] LOADER: set _MEIPASS2 to /var/folders/m7/322j4l357l3chdczl5j75phw0000gn/T/_MEIlAeO5C
[22699] LOADER: Registering signal handlers
[22704] PyInstaller Bootloader 3.x
[22704] LOADER: executable is /Users/bernard/projects/gralli_quest/dist/gralli_quest.app/Contents/MacOS/gralli_quest
[22704] LOADER: homepath is /Users/bernard/projects/gralli_quest/dist/gralli_quest.app/Contents/MacOS
[22704] LOADER: _MEIPASS2 is /var/folders/m7/322j4l357l3chdczl5j75phw0000gn/T/_MEIlAeO5C
[22704] LOADER: archivename is /Users/bernard/projects/gralli_quest/dist/gralli_quest.app/Contents/MacOS/gralli_quest
[22704] LOADER: Cookie found at offset 0x17CD99D2
[22704] LOADER: Already in the child - running user`s code.
[22704] LOADER: Python library: /var/folders/m7/322j4l357l3chdczl5j75phw0000gn/T/_MEIlAeO5C/libpython3.9.dylib
[22704] Error loading Python lib `/var/folders/m7/322j4l357l3chdczl5j75phw0000gn/T/_MEIlAeO5C/libpython3.9.dylib`: dlopen: dlopen(/var/folders/m7/322j4l357l3chdczl5j75phw0000gn/T/_MEIlAeO5C/libpython3.9.dylib, 10): image not found
[22699] LOADER: Restoring signal handlers
[22699] LOADER: freeing args
[22699] LOADER: returning child exit status 255
[22699] LOADER: Back to parent (RC: 255)
[22699] LOADER: Doing cleanup
[22699] LOADER: Freeing archive status for /Users/bernard/projects/gralli_quest/dist/gralli_quest.app/Contents/MacOS/gralli_quest
Run Code Online (Sandbox Code Playgroud)
文件 libpython3.9.dylib 确实存在于 pyinstaller 创建的 .app 文件夹中:
ls -al dist/gralli_quest.app/Contents/MacOS/libpython3.9.dylib
-rwxr-xr-x 1 bernard staff 3831440 Dec 16 17:20 dist/gralli_quest.app/Contents/MacOS/libpython3.9.dylib
Run Code Online (Sandbox Code Playgroud)
我尝试过的事情:
env PYTHON_CONFIGURE_OPTS="--enable-framework" pyenv install 3.9.9)可以提供我的 .spec 文件或任何其他有帮助的信息。