我试着遵循cython的教程。
- https://cython.readthedocs.io/en/latest/src/quickstart/build.html building-a-cython-module-using-setuptools
在生成hello.pyx/setup.py文件后,我执行它进行编译
$ python setup.py build_ext --inplace
但我得到的是这样的。
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:220:5: error: 'TARGET_OS_EMBEDDED' is not defined, evaluates to 0 [-Werror,-Wundef-prefix=TARGET_OS_]
#if TARGET_OS_EMBEDDE
.
.
.
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:181:5: error: 'TARGET_OS_E
MBEDDED' is not defined, evaluates to 0 [-Werror,-Wundef-prefix=TARGET_OS_]
#if TARGET_OS_EMBEDDED
^
.
.
.
194 warnings and 2 errors generated.
error: command 'clang' failed with exit status 1
因为错误/警告消息非常长。我粘贴了一部分
我成功了!
$ export CC=gcc
$ python setup.py build_ext --inplace
# success!
环境价值才是重点。