Search code examples
pythonpython-module

Package a python project that contains a .so library


I want to package my python project using this official tutorial

The problem is that my project uses a .so external library. When I make a package and import it in a random python script, i get this error:

ModuleNotFoundError: No module named 'myExternalLib'

I couldn't find any tutorial on how to add an external library to my package, I think I'm not searching with the right keywords.


Solution

  • I think the easiest solution is to add the external library as a package data.

    setup(
        ..... 
        packages=['myLib'],
        package_data={'myLib': ['myExternalLib.so']},
    )