py2app Mach-O头错误

时间:2017-01-31 12:36:51

标签: python-3.x py2app

我正在尝试在以下代码中使用py2app:

print(1+1)

我用以下方式创建我的设置:

py2applet --make-setup test.py

使用别名模式开发工作正常:

python3 setup.py py2app -A

但是当我尝试独立模式时:

python3 setup.py py2app

我记得很多:

WARNING: Mach-O header in '/Users/quentinpeter/Documents/PHD/Python/People project/Michele_worms/dist/test.app/Contents/Resources/lib/python3.6/scipy/linalg/_interpolative.cpython-36m-darwin.so' may be too large to relocate
WARNING: Mach-O header in '/Users/quentinpeter/Documents/PHD/Python/People project/Michele_worms/dist/test.app/Contents/Resources/lib/python3.6/scipy/linalg/_interpolative.cpython-36m-darwin.so' may be too large to relocate
Traceback (most recent call last):
  File "setup.py", line 18, in <module>
    setup_requires=['py2app'],
  File "/usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "/usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/usr/local/lib/python3.6/site-packages/py2app/build_app.py", line 764, in run
    self._run()
  File "/usr/local/lib/python3.6/site-packages/py2app/build_app.py", line 974, in _run
    self.run_normal()
  File "/usr/local/lib/python3.6/site-packages/py2app/build_app.py", line 1082, in run_normal
    self.create_binaries(py_files, pkgdirs, extensions, loader_files)
  File "/usr/local/lib/python3.6/site-packages/py2app/build_app.py", line 1385, in create_binaries
    platfiles = mm.run()
  File "/usr/local/lib/python3.6/site-packages/macholib/MachOStandalone.py", line 146, in run
    node.write(f)
  File "/usr/local/lib/python3.6/site-packages/macholib/MachO.py", line 133, in write
    header.write(f)
  File "/usr/local/lib/python3.6/site-packages/macholib/MachO.py", line 343, in write
    self.synchronize_size()
  File "/usr/local/lib/python3.6/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 '/Users/quentinpeter/Documents/PHD/Python/People project/Michele_worms/dist/test.app/Contents/Resources/lib/python3.6/scipy/linalg/_interpolative.cpython-36m-darwin.so' (new size=1764, max size=1712, delta=108)

你知道会发生什么吗?我在网上发现的大部分内容都是指MacPorts,但我使用的是自制软件。

我的python上的信息:

Python 3.6.0 (default, Dec 24 2016, 08:01:42) 
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin

1 个答案:

答案 0 :(得分:1)

我遇到了同样的问题,我通过卸载我拥有的Macholib版本(1.8)并使用pip安装1.7来修复它。当使用python 2.7时,恢复为scipy版本0.14.0也会修复它。