用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 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章