Cython

参考链接:
官方文档:https://cython.readthedocs.io/en/latest/
中文文档:https://www.bookstack.cn/read/cython-doc-zh/docs-29.md
多个库编译成一个库:https://paper.seebug.org/1139/
https://stackoverflow.com/questions/30157363/collapse-multiple-submodules-to-one-cython-extension

源代码封装成动态库

python setup.py build_ext --inplace

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

extensions = [
    Extension(
        "mesh_net.network", ["network.py"]
    ),
    Extension(
        "mesh_net.mesh", ["mesh.py"]
    ),
    Extension(
        "mesh_net.mesh_process", ["mesh_process.py"]
    ),
    Extension(
        "mesh_net.mesh_union", ["mesh_union.py"]
    )
]

setup(
    name="mesh_net",
    ext_modules=cythonize(extensions)
)
原文地址:https://www.cnblogs.com/xiaxuexiaoab/p/14462035.html