参考: https://blog.youkuaiyun.com/weixin_44745717/article/details/89381469
安装Cython
实现setup.py文件
# cython: language_level=3
from setuptools import setup
from Cython.Build import cythonize
#
# setup(name='Hello',
# version='1.0',
# description='A simple example',
# author='Magnus Lie Hetland',
# py_modules=['hello'])
# setup(ext_modules=cythonize('hello.py'))
from setuptools import setup, Extension
setup(name='palindrome',
version='1.0',
ext_modules = [
Extension('palindrome', ['palindrome2.c'])
])
执行命令:
python3 setup.py build_ext --inplace