cython编译Python为c语言 cython编译Python为c语⾔ 第⼀种办法:执⾏命令:cython test.py 结果:会在同⼀⽬录下⾯⽣成test.c⽂件 执⾏命令: gcc -c -fPIC -I /usr/include/python2.7 test.c 结果:在同⼀⽬录下⾯⽣成test.o⽂件 执⾏命令: gcc -shared test.o -c test....
name ="test", ext_modules =cythonize("test.py") ) 执行命令: python setup.py build_ext --inplace 第二种办法是对单独文件进行编译,下面介绍一种批量的办法: #-*- coding:utf-8 -*-_importosimportrefromdistutils.coreimportExtension, setupfromCython.BuildimportcythonizefromCython.CompilerimportOption...