Cython“HelloWorld”示例未运行,但编译器?

2024-04-23 23:34:34 发布

您现在位置:Python中文网/ 问答频道 /正文

来自http://cython.readthedocs.io/en/latest/src/tutorial/cython_tutorial.html的cython“Hello World”示例 在我的windows系统上没有运行,而编译器正在工作

如果有任何提示,我会努力解决这个问题。。。在

更详细地说:

GCC似乎可以在windows上运行;因为编译这个C示例起到了作用:

#include <stdio.h>

int main (){
    printf("Hello world");
    return 0;

}

现在回到Cython的例子: 它在Ubuntu上运行,但是在windows中抛出以下错误:

^{pr2}$

这里是hello world代码:

在地狱世界.pyx公司名称:

print("Hello World")

在设置.py公司名称:

from distutils.core import setup
from Cython.Build import cythonize

setup(
    ext_modules = cythonize("helloworld.pyx")
)

命令:

python setup.py build_ext --inplace

Tags: frompyimport名称示例helloworldwindows