I am using Python 3 from the Anaconda distribution, and trying to convert a simple python program into an OS X app (running on El Capitan). Following the instructions in the
The suggestion by @l'L'l allowed me to identify the problem: While there were no errors when I generated my app in "alias mode" (using symlinks to the environment instead of copying binaries), building the app without alias mode flushed out the error: py2app
looks for the libpython
DLL under the non-existent name /Applications/anaconda/lib/libpython3.4.dylib
.
A quick check showed that Anaconda provides this DLL under a slightly different name: libpython3.4m.dylib
. While patching dist/my-script.app/Contents/Info.plist
fixes the problem, the right solution is to edit setup.py
so that future builds will work correctly. With the help of the py2app documentation, I put together the following (partial contents of setup.py
shown):
OPTIONS = {'argv_emulation': True,
'plist': {
'PyRuntimeLocations': [
'@executable_path/../Frameworks/libpython3.4m.dylib',
'/Applications/anaconda/lib/libpython3.4m.dylib'
]
}}
setup(
app=APP,
data_files=DATA_FILES,
options={'py2app': OPTIONS},
setup_requires=['py2app'],
)
The paths come from the generated Info.plist
; I only modified the absolute path, reasoning that if I ever provide a local DLL at the relative path, it will have the default name.