我在Mac OS X 10.10(以及VM上的10.8)上开发了Python3.4 + PyQt5软件(Tractotron),我想为mac制作一个独立的可执行文件。我尝试了两个py2app(很适合我......)和cx_freeze。最后,当我尝试在没有Python3.4的情况下在OS X上启动我的应用程序时出现错误:
dyld: Library not loaded: /Library/Frameworks/Python.framework/Versions/3.4/Python
Referenced from: /Users/~/Downloads/build/resources/Tractotron
Reason: no suitable image found. Did find:
/Library/Frameworks/Python.framework/Versions/3.4/Python:
no matching architecture in universal wrapper
/Library/Frameworks/Python.framework/Versions/3.4/Python:
no matching architecture in universal wrapper
我尝试在我的虚拟机中使用源代码安装cx_freeze,并在我的mac中使用macports但是我总是遇到同样的错误。
我有这个setup.py:
# -*-coding:Utf-8 -*
from cx_Freeze import setup, Executable
inc_files = ["img"]
build_exe_options = {"packages": ["os", "sip", "subprocess"], "excludes": ["tkinter"],
"include_files": inc_files}
setup(
name = "Tractotron",
version = "1.0",
description = "The Tractotron !",
options = {"build_exe": build_exe_options},
executables = [Executable("interface.py", targetName="Tractotron")],
)
实际上,当我运行python3 setup.py bdist_mac时,生成的.app不起作用,我使用.command脚本来调用可执行文件。
这很丑,但我不知道如何修复.app。
我也尝试过在网上找到的解决方案,比如工具-L和install_name_tool,但没有任何作用......
也许它可以帮助otool的结果:
otool -L build/exe.macosx-10.10-x86_64-3.4/Tractotron
build/exe.macosx-10.10-x86_64-3.4/Tractotron:
/opt/local/Library/Frameworks/Python.framework/Versions/3.4/Python (compatibility version 3.4.0, current version 3.4.0)
/opt/local/lib/libintl.8.dylib (compatibility version 10.0.0, current version 10.3.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1151.16.0)
我希望有人会帮助我,因为我正在寻找解决这个问题的日子......
提前感谢您的帮助。
晚上好。