gpt4 book ai didi

python - py2app 在 Anaconda Python 3 上失败

转载 作者:行者123 更新时间:2023-11-30 22:36:27 25 4
gpt4 key购买 nike

我正在尝试使用 py2app 使用 Python 3 构建我的 wxPython 应用程序。在将代码更新到 Python 3 之前,我能够在 Python 2 中成功完成此操作。

修复了一些初始问题(必须 sys.setrecursionlimit(2000) 并降级到 Python 3.5)后,我陷入了困境:

Traceback (most recent call last):
File "setup_pmag_gui.py", line 23, in <module>
setup_requires=['py2app'],
File "/Users/****/anaconda/lib/python3.5/distutils/core.py", line 148, in setup
dist.run_commands()
File "/Users/****/anaconda/lib/python3.5/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/Users/****/anaconda/lib/python3.5/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/Users/****/my_project/.eggs/py2app-0.13-py3.5.egg/py2app/build_app.py", line 757, in run
self._run()
File "/Users/****/my_project/.eggs/py2app-0.13-py3.5.egg/py2app/build_app.py", line 967, in _run
self.run_normal()
File "/Users/****/my_project/.eggs/py2app-0.13-py3.5.egg/py2app/build_app.py", line 1075, in run_normal
self.create_binaries(py_files, pkgdirs, extensions, loader_files)
File "/Users/****/my_project/.eggs/py2app-0.13-py3.5.egg/py2app/build_app.py", line 1385, in create_binaries
mm.mm.run_file(runtime)
File "/Users/****/my_project/.eggs/macholib-1.8-py3.5.egg/macholib/MachOGraph.py", line 83, in run_file
ValueError: '/Users/****/anaconda/lib/libpython3.5.dylib' does not exist
不过,

/Users/****/anaconda/lib/libpython3.5m.dylib 确实存在。有没有办法告诉 MachOGraph 如何找到这个?

我使用的是 OS X 10.12.4,使用的是 Anaconda Python 3.5。我的 py2app 版本是 0.13。

这就是我的 setup.py 文件的样子:

from setuptools import setup
import sys
import os
directory = os.getcwd()
sys.setrecursionlimit(3000)

APP = ['programs/pmag_gui.py']
DATA_FILES = [('', ['dialogs/help_files', 'pmagpy/data_model', 'programs/images'])]
OPTIONS = {'argv_emulation': False,
'iconfile': os.path.join(directory, 'programs', 'images', 'text_x_xslfo.icns')}

setup(
app=APP,
data_files=DATA_FILES,
options={'py2app': OPTIONS},
setup_requires=['py2app'],

)

阅读 Tweaking your Info.plist py2app documentation 后,和 this question ,我尝试添加到选项:

'plist': dict(PyRuntimeLocations=['/Users/****/anaconda/lib/libpython3.5m.dylib'])

但我得到了与以前相同的错误消息。

有关如何解决此问题的任何建议,或者查看哪些文档?

最佳答案

我在使用 miniconda 和 py2app 时遇到了同样的问题。我可以通过创建符号链接(symbolic link)来修复它!

 ln -s /path/to/lib/libpython3.5m.dylib /path/to/lib/libpython3.5.dylib

关于python - py2app 在 Anaconda Python 3 上失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44169646/

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