gpt4 book ai didi

python - Py2App:别名模式有效,但部署无效

转载 作者:太空宇宙 更新时间:2023-11-03 11:03:42 25 4
gpt4 key购买 nike

我正在尝试使用 py2app 部署我的 python 应用程序。

我使用以下方法创建了安装文件:py2applet --make-setup MyApplication.py

然后我这样做来测试它:python setup.py py2app -A

同样有效。我的 GUI 程序运行。

当我尝试最后一步时:python setup.py py2app

我得到了这个错误。

Traceback (most recent call last):
File "setup.py", line 18, in <module>
setup_requires=['py2app'],
File "/usr/local/Cellar/python/2.7.8_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/usr/local/Cellar/python/2.7.8_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/local/Cellar/python/2.7.8_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/usr/local/lib/python2.7/site-packages/py2app/build_app.py", line 659, in run
self._run()
File "/usr/local/lib/python2.7/site-packages/py2app/build_app.py", line 865, in _run
self.run_normal()
File "/usr/local/lib/python2.7/site-packages/py2app/build_app.py", line 959, in run_normal
self.create_binaries(py_files, pkgdirs, extensions, loader_files)
File "/usr/local/lib/python2.7/site-packages/py2app/build_app.py", line 1214, in create_binaries
platfiles = mm.run()
File "/usr/local/lib/python2.7/site-packages/macholib/MachOStandalone.py", line 105, in run
mm.run_file(fn)
File "/usr/local/lib/python2.7/site-packages/macholib/MachOGraph.py", line 84, in run_file
self.scan_node(m)
File "/usr/local/lib/python2.7/site-packages/macholib/MachOGraph.py", line 110, in scan_node
m = self.load_file(filename, caller=node)
File "/usr/local/lib/python2.7/site-packages/macholib/MachOGraph.py", line 93, in load_file
newname = self.locate(name, loader=caller)
File "/usr/local/lib/python2.7/site-packages/macholib/MachOStandalone.py", line 23, in locate
newname = super(FilteredMachOGraph, self).locate(filename, loader)
File "/usr/local/lib/python2.7/site-packages/macholib/MachOGraph.py", line 49, in locate
loader=loader.filename)
TypeError: dyld_find() got an unexpected keyword argument 'loader'

为什么会这样?我花了最后几个小时尝试部署。 py2app、cx_freeze 等没有运气。

最佳答案

这是一个解决方法:编辑文件 MachOGraph.py,在您的情况下该文件位于此处:

/usr/local/lib/python2.7/site-packages/macholib/MachOGraph.py

搜索术语 loader=loader.filename) 并将其替换为 loader_path=loader.filename)

感谢 David Goldenberg 在 bitbucket.org 上的帖子。 https://bitbucket.org/ronaldoussoren/py2app/issues/137/py2app-problems-using-enthought-python

关于python - Py2App:别名模式有效,但部署无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25982374/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com