用cython 给python 写c扩展

##hw.py

#coding:gbk

def hi():

print "hello the cython"

#setup.py

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("hw",["hw.py"])]

)

 构建使用命令 python setup.py build_ext --inplace 

你可能感兴趣的:(python,职场,休闲,cython)