Launch python into a mac application

删除回忆录丶 提交于 2019-12-23 14:24:10

问题


I have a software written in python with a graphical user interface written in PyQt. To create an executable of the software I ship with it a Python and a Qt precompiled version and the trick seems to work in windows and linux since I know How to create an istaller. The problem is to embed evrything into a mac .app To launch the software I use the following shel script

export DYLD_LIBRARY_PATH=`pwd`/lib:$DYLD_LIBRARY_PATH
export DYLD_FRAMEWORK_PATH=`pwd`/Resources
PYTHONPATH=$PYTHONPATH:. bin/python ProgramPy/Main.py

If I run this shell script from outside it works fine but when I try to embed everything into an app with platypus I get the following error.

dyld: Library not loaded: @executable_path/../.Python
  Referenced from: /Users/luca/Desktop/TempScript.app/Contents/Resources/bin/python
  Reason: image not found
./run.sh: line 3:   725 Trace/BPT trap          PYTHONPATH=$PYTHONPATH:. bin/python ProgramPy/Main.py

Note that the file /Users/luca/Desktop/TempScript.app/Contents/Resources/bin/python is the executable version of python and it is actually located into the Resources folder of the app. I don't understand why the system cannot find it... Maybe I miss something in understanding how mac uses the pythonpath ...

Thanks


回答1:


I just use py2app.



来源:https://stackoverflow.com/questions/4206511/launch-python-into-a-mac-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!