I am building a PyObjC app using Xcode 4.6.2 and am trying to figure out how to bundle the Python framework in with my app, so that I can reference it without relying on the host system having a particular Python version.
(I previously asked this question, but since then, I've decided that embedding the framework is the better way to go.)
I know this is a thing that people do -- in my experience, most standalone Python apps package a Python installation within them. But I can't figure out how to get it to work for me.
I have copied Python.framework into my project using the Build Phases "Copy Files" panel, and Python.framework does show up in my app bundle, but I can't figure out how to get the application to reference it.
If I link to Python.framework in "Linked Frameworks and Libraries" in Xcode, the app builds properly, but fails on launch on 10.6 with the error
Dyld Error Message:
Library not loaded: /System/Library/Frameworks/Python.framework/Versions/2.7/Python
Referenced from: {/path/to/my/app}
Reason: image not found
...because 10.6 only has Python 2.5, and it's searching for the system framework, not the one included in my app bundle.
If I don't link to the Python framework in Xcode, the app fails to build.
So how do I tell my application that I want it to use the Python.framework bundled inside my app at appname.app/Contents/Frameworks/Python.framework
, and NOT the system Python.framework located at /System/Library/Frameworks/Python.framework
?
I'm at a bit of an impasse with this issue, and any help would be greatly appreciated.