How to build a Python C Extension so I can import it from a module

岁酱吖の 提交于 2019-11-28 06:27:19

Just change

Extension('c_extension', ...)

to

Extension('foo.bar.c_extension', ...)

You will need __init__.py files in each of the foo and bar directories, as usual. To have these packaged with the module in your setup.py, you need to add

packages = ['foo', 'foo.bar'],

to your setup() call, and you will need the directory structure

setup.py
foo/
    __init__.py
    bar/
        __init__.py

in your source directory.

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