How to include a shared C library in a Python package

亡梦爱人 提交于 2019-12-03 01:32:27

You can create a Python package which includes shared libraries and works on (almost) any linux distro using manylinux.

The goal of the manylinux project is to provide a convenient way to distribute binary Python extensions as wheels on Linux. This effort has produced PEP 513 which defines the manylinux1_x86_64 and manylinux1_i686 platform tags.

The general procedure is:

  1. Build the external library and the Python package inside one of the docker containers provided by the manylinux team (see python-manylinux-demo)
  2. Run auditwheel repair to copy the external shared libraries that your package depends on into the Python wheel, setting the RPATH accordingly.

See .travis.yml and build-wheels.sh in the python-manylinux-demo repo for an example.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!