将python启动到Mac应用程序中 [英] Launch python into a mac application

查看:339
本文介绍了将python启动到Mac应用程序中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用python编写的软件,带有用PyQt编写的图形用户界面. 为了创建该软件的可执行文件,我附带了一个Python和Qt预编译版本,由于我知道如何创建istaller,所以该技巧似乎在Windows和Linux中都有效. 问题是将evrything嵌入到Mac .app中 要启动该软件,请使用以下shel脚本

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

如果我从外部运行此Shell脚本,则可以正常运行,但是当我尝试将所有内容都与鸭嘴兽嵌入到应用程序中时,会出现以下错误.

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

请注意,文件/Users/luca/Desktop/TempScript.app/Contents/Resources/bin/python 是python的可执行版本,它实际上位于应用程序的Resources文件夹中.我不明白为什么系统找不到它... 也许我错过了一些了解Mac如何使用pythonpath的东西...

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 ...

谢谢

推荐答案

我只使用 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆