I have some python files, and all operation exposure to others in a Main file. I want to compile them and distribute one .so
for others.
I try cython to compile them but more than one .so
generated (works but not perfect).
example:
The folder structure is:
CythonExample/
|——for_call.py
|——setup.py
|——Student.py
setup.py
from distutils.core import setup, Extension
from Cython.Build import cythonize
setup(
ext_modules=cythonize(["Student.py", "for_call.py"]),
)
python setup.py build_ext --inplace
then I get Student.so
and for_call.so
.
I modify setup.py to:
from distutils.core import setup, Extension
from Cython.Build import cythonize
setup(
name='sayname',
ext_modules=cythonize(Extension("sayname", sources=["Student.py", "for_call.py"], language="c")),
)
then
python setup.py build_ext --inplace
, well, only sayname.so
generated. but when i try to import it.
import sayname
ImportError: dynamic module does not define init function (initsayname)
thanks.