Mac上的py2app Mach-O标头

时间:2017-07-06 08:05:41

标签: python macos wxpython anaconda py2app

我在macOS Sierra 10.12.5上创建了一个wxpython GUI应用程序。我正在尝试使用py2app创建一个独立的应用程序。我的python安装:

Python 2.7.13 (Anaconda intel python, virtual environment).
py2app 0.14

这是我的设置python代码:

#!/usr/bin/env python
"""
$ python build_CtAnnotator.py - script for building CtAnnotator

Usage:
    % python build_CtAnnotator.py py2app
"""
from setuptools import setup
import sys
# from distutils.core import setup

sys.setrecursionlimit(20000)

APP = ['CtAnnotator.py']
OPTIONS = {'site_packages': True,
           'argv_emulation': True,
           'alias': False,
           'plist': {'PyRuntimeLocations': ['/opt/anaconda2/envs/intelpython2/lib/libpython2.7.dylib']}
          }

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

这是我在py2app输出的许多行之后得到的错误。

WARNING: Mach-O header in '/Volumes/<...>/Repository/CtAnnotation/dist/CtAnnotator.app/Contents/Resources/lib/python2.7/lib-dynload/numba/_dispatcher.so' may be too large to relocate
Traceback (most recent call last):
  File "build_CtAnnotator.py", line 24, in <module>
    setup_requires=['py2app'],
  File "/opt/anaconda2/envs/intelpython2/lib/python2.7/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/opt/anaconda2/envs/intelpython2/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/opt/anaconda2/envs/intelpython2/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/opt/anaconda2/envs/intelpython2/lib/python2.7/site-packages/py2app/build_app.py", line 825, in run
    self._run()
  File "/opt/anaconda2/envs/intelpython2/lib/python2.7/site-packages/py2app/build_app.py", line 1040, in _run
    self.run_normal()
  File "/opt/anaconda2/envs/intelpython2/lib/python2.7/site-packages/py2app/build_app.py", line 1152, in run_normal
    self.create_binaries(py_files, pkgdirs, extensions, loader_files)
  File "/opt/anaconda2/envs/intelpython2/lib/python2.7/site-packages/py2app/build_app.py", line 1512, in create_binaries
    platfiles = mm.run()
  File "/opt/anaconda2/envs/intelpython2/lib/python2.7/site-packages/macholib/MachOStandalone.py", line 146, in run
    node.write(f)
  File "/opt/anaconda2/envs/intelpython2/lib/python2.7/site-packages/macholib/MachO.py", line 133, in write
    header.write(f)
  File "/opt/anaconda2/envs/intelpython2/lib/python2.7/site-packages/macholib/MachO.py", line 343, in write
    self.synchronize_size()
  File "/opt/anaconda2/envs/intelpython2/lib/python2.7/site-packages/macholib/MachO.py", line 333, in synchronize_size
    self.parent.filename, self.total_size + self.sizediff, self.low_offset, self.sizediff))
  ValueError: New Mach-O header is too large to relocate in '/Volumes/<...>/Repository/CtAnnotation/dist/CtAnnotator.app/Contents/Resources/lib/python2.7/lib-dynload/numba/_dispatcher.so' (new size=1752L, max size=1744L, delta=24L)
K评论说(py2app Mach-O header error)这可以通过将scipy降级到0.14.0来解决。除了这不是一个公认的答案,降级scipy与我的安装的intelpython核心版本不兼容。 (事实上​​,在这个重要方面,我的python配置与之前的OP不同。)任何建议或其他解决方案?

0 个答案:

没有答案