好的 - 来了。我正在尝试学习如何使用 py2app,所以我创建了一个简单的 python 文件;只是 hello_world.py
#! /usr/bin/env python
def main():
print "Hello"
if __name__=="__main__":
main()
我按照教程进行了以下操作:
py2applet --make-setup hello.py
python setup.py py2app -A
这创建了两个子目录(build 和 dist),在 dist 中有一个名为 hello.app 的文件。我试图通过 GUI 启动它,但它启动不到一秒钟然后就消失了。然后我去了 CL,但只是尝试运行它没有用,所以我使用了:
python hello.app
出现以下错误:
/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python: can't find '__main__.py' in 'hello.app'
我花了一整天的时间在谷歌上搜索,但找不到任何教程或指南等。我真的被困住了:-(
我不知道这是否有帮助,但这就是 setup.py 中的内容
"""
This is a setup.py script generated by py2applet
Usage:
python setup.py py2app
"""
from setuptools import setup
APP = ['hello.py']
DATA_FILES = []
OPTIONS = {'argv_emulation': True}
setup(
app=APP,
data_files=DATA_FILES,
options={'py2app': OPTIONS},
setup_requires=['py2app'],
)