py2app失败了Anaconda Python 3

时间:2017-05-24 22:43:40

标签: python anaconda py2app

我正在尝试使用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 documentationthis question后,我尝试添加到OPTIONS:

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

但是我得到了和以前一样的错误信息。

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

1 个答案:

答案 0 :(得分:3)

我和miniconda和py2app有同样的问题。我可以通过创建符号链接来修复它!

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