Python py2app导入中断cython

Python py2app导入中断cython,python,cython,py2app,Python,Cython,Py2app,我使用的是Cython文档中的基本“hello world”演示。除非我尝试在同一setup.py文件中导入py2app,否则它工作正常: import py2app from distutils.core import setup from distutils.extension import Extension from Cython.Distutils import build_ext setup( cmdclass = {'build_ext': build_ext},

我使用的是Cython文档中的基本“hello world”演示。除非我尝试在同一setup.py文件中导入py2app,否则它工作正常:

import py2app
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext

setup(
    cmdclass = {'build_ext': build_ext},
    ext_modules = [Extension("helloworld", ["helloworld.pyx"])]
)
只要我为Cython模块预生成
.c
文件,Py2app本身就可以正常工作。但如果我没有,则
build\u ext
会失败:

running build_ext
gcc-4.2 not found, using clang instead
building 'helloworld' extension
clang -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -g -O2 -DNDEBUG -g -O3 -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c helloworld.c -o build/temp.macosx-10.6-intel-2.7/helloworld.o
clang: error: no such file or directory: 'helloworld.c'
clang: error: no input files
error: command 'clang' failed with exit status 1
如果我在setup.py中注释掉
import py2app
build\u ext
工作正常,我会在编译中得到缺少的中间步骤:

...
gcc-4.2 not found, using clang instead
cythoning helloworld/helloworld.pyx to helloworld/helloworld.c
building 'helloworld' extension
...
那么py2app是什么让Cython崩溃的呢?我能做些什么呢?显然,我希望我的项目只有一个setup.py


我有Cython 0.18和py2app 0.7.2,它们是从PyPI安装的。我在python.org python 2.7.3中使用Mac OS X 10.8,而不是苹果的版本。

由于py2app使用setuptools,并且setuptools(和distribution)的旧版本与Cython不兼容,所以该版本失败


解决方案是安装较新版本的setuptools或distribute。

将“导入py2app”替换为“导入setuptools”时会发生什么?Py2app本身不修补distutils,但使用setuptools。另外:这可能与distribute issue tracker中的有关。万岁,这就是问题所在<代码>导入设置工具也破坏了Cython。安装
distribute
(0.6.36)而不是
setuptools
(0.6.c11)修复了它。请作为答案提交,我将接受…为了完整性,我确实在PyPI上提供了最新版本的setuptools。Distribute当然是setuptools的替代品,包括Cython修复程序。