How to include a shared C library in a Python package

前端 未结 2 1306
野的像风
野的像风 2020-12-25 08:43

I have a project depending on a shared library. To make it clear from the beginning: the shared library is a pure C library and not a Python library. For reasons of simplici

2条回答
  •  臣服心动
    2020-12-25 08:51

    package_data is for data. setup can do the compilation into an *.so.

    Following my solution in python setup.py build ctypes.CDLL: cannot open shared object file: No such file or directory, I think your setup could employ ext_modules and py_modules, something like

    setup(name='pkgtest',
          py_modules=['pkgtest'],
          ext_modules=[Extension('src.libhello', ['src/libhello.c'])]
         )
    

提交回复
热议问题