将 py2app 与 tkinter 和 openpyxl 以及多个文件一起使用? [英] Using py2app with tkinter and openpyxl and multiple files?

查看:69
本文介绍了将 py2app 与 tkinter 和 openpyxl 以及多个文件一起使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过搜索,这就是我的 setup.py 现在的样子.当我使用 -A 模式(别名)构建我的应用程序然后尝试运行它时,我收到此错误:

From searching around this is what my setup.py is right now. When I build my application using the -A mode (alias) then try to run it I get this error:

在控制台中我发现这个错误:

In the console I find this error:

8/21/13 10:09:46.203 PM com.apple.launchd.peruser.501[249]: ([0x0-0x150d50c].org.pythonmac.unspecified.notebook_tracker[24469]) 退出代码:255

8/21/13 10:09:46.203 PM com.apple.launchd.peruser.501[249]: ([0x0-0x150d50c].org.pythonmac.unspecified.notebook_tracker[24469]) Exited with code: 255

我的 setup.py 代码:

My setup.py code:

"""
This is a setup.py script generated by py2applet

Usage:
    python setup.py py2app
"""

from setuptools import setup
APP = ['notebook_tracker.app']
DATA_FILES = ['notebook_tracker.pyw']
OPTIONS = {'argv_emulation': True,
            'packages': ['openpyxl','Tkinter']}

setup(
    app=APP,
    data_files=DATA_FILES,
    options={'py2app': OPTIONS},
    setup_requires=['py2app'],
    py_modules=['DialogTemplate','reports','customer','schedule','admin','log_data','payment']
)

推荐答案

我找到了解决我自己问题的方法.openpyxl 是一个包含在 .egg 文件中的库.py2app 和 py2exe 不能很好地处理 .egg 文件.一旦我解压缩了 .egg 文件并将其放入我的项目中,一切都运行良好.此外,我的 setup.py 文件不需要那么复杂,下面是有效的 setup.py.此外,我停止在别名模式下构建它,它工作得很好.

I found the solution to my own problem. openpyxl is a library contained in a .egg file. py2app and py2exe don't play nicely with .egg files. Once I unzipped the .egg file and placed it in my project everything worked nicely. Also my setup.py file didn't need to be nearly as complicated, below is the setup.py that works. Also, I stopped building it in alias mode and it worked just fine.

"""
Script for building the example.

Usage:
    python setup.py py2app
"""

from setuptools import setup

setup(
    app=['notebook_tracker.pyw'],
    setup_requires=["py2app"],
)

这篇关于将 py2app 与 tkinter 和 openpyxl 以及多个文件一起使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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