且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何为 MacOs Big Sur 使用 pyinstaller?

更新时间:2023-01-14 23:24:07

PyInstaller当前在Big Sur上存在问题,原因如下:

PyInstaller currently has problem on Big Sur for this reason:

macOS Big Sur 11.0.1中的新增功能,该系统附带内置的动态所有系统提供的库的链接器缓存.作为此更改的一部分,文件系统中不再存在动态库的副本.尝试通过查看来检查动态库是否存在的代码路径中的文件或枚举目录将失败.反而,尝试通过dlopen()路径检查库是否存在,将正确检查缓存中的库.(62986286)

New in macOS Big Sur 11.0.1, the system ships with a built-in dynamic linker cache of all system-provided libraries. As part of this change, copies of dynamic libraries are no longer present on the filesystem. Code that attempts to check for dynamic library presence by looking for a file at a path or enumerating a directory will fail. Instead, check for library presence by attempting to dlopen() the path, which will correctly check for the library in the cache. (62986286)

执行pyinstaller时,您会丢失系统库

You'll missing system libraries when you execute pyinstaller

此处进行了一些讨论,但该错误尚未得到修复.(2020年12月21日)

There are some discussing here, but the bug has not been fixed yet. (Dec 21 2020)

作为 pyinstaller文档建议,***使用旧版本的OSX向前兼容.

As the pyinstaller document suggests, you'd better use old version of the OSX for forward compatible.

只需运行:

pyinstaller --windowed my_code.py