cython "Hello World" 分段错误(核心已转储)

cython "Hello World" Segmentation fault (core dumped)

$cat say.py
print('Hello World!')

$python --version
Python 2.7.11+

$python say.py
Hello World!

$cython --version
Cython version 0.23.4

$cython say.py
$gcc `pkg-config --cflags --libs python` -o say say.c -lpython2.7 -lpthread -lm -lutil -ldl -fPIC -shared

$./say
Segmentation fault (core dumped)

gcc 编译一个 模块 可以被 python:

导入
% cython say.py
% gcc `pkg-config --cflags --libs python` -o say.so say.c -lpython2.7 -lpthread -lm -lutil -ldl -fPIC -shared
% /bin/rm say.py   # make sure we aren't just importing say.py
% ls -l say*
-rwxrwxr-x 1 unutbu unutbu 19693 Apr  8 07:52 say.so
-rw-rw-r-- 1 unutbu unutbu 68614 Apr  8 07:52 say.c

% python
Python 2.7.6 (default, Mar 22 2014, 22:59:56) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import say
Hello World!
>>> 

另请参阅 "Building Cython Code" 以了解构建 Cython 代码的其他更好方法。