简体   繁体   English

将python启动到mac应用程序中

[英]Launch python into a mac application

I have a software written in python with a graphical user interface written in PyQt. 我有一个用python编写的软件,用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. 要创建软件的可执行文件,我随附了一个Python和一个Qt预编译版本,这个技巧似乎适用于Windows和Linux,因为我知道如何创建一个istaller。 The problem is to embed evrything into a mac .app To launch the software I use the following shel script 问题是将evrything嵌入到mac .app中为了启动软件,我使用了以下的shel脚本

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. 如果我从外面运行这个shell脚本它工作正常,但当我尝试将所有内容嵌入到platypus的应用程序中时,我收到以下错误。

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. 请注意,文件/Users/luca/Desktop/TempScript.app/Contents/Resources/bin/python是python的可执行版本,它实际上位于应用程序的Resources文件夹中。 I don't understand why the system cannot find it... Maybe I miss something in understanding how mac uses the pythonpath ... 我不明白为什么系统找不到它...也许我错过了解mac如何使用pythonpath ...

Thanks 谢谢

我只是使用py2app

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM