#setup.py
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
setup(
cmdclass = {'build_ext': build_ext},
ext_modules = [Extension("module_name", ["xxxx.pyx", './yyyyy.c'],
language='c',
extra_compile_args = ['-std=gnu11'],
extra_link_args=['-std=gnu11']
)]
)
$ python --version
Python 3.5.1
$ python -c "import cython; print(cython.__version__);"
0.25.2
$ python setup.py build_ext -i
Question> Why Cython generates the module name as module_name.cpython-35m-x86_64-linux-gnu.so
instead of module_name.so
?
Thank you
A full description is available in PEP 3149. In short: this is a change that applies from Python 3.2 onwards. A version identifier is deliberately added to the filename; filenames with this version identifier are used in preference to those without (but a plain .so or .pyd file without the version identifier will be used if no other option is available to import).
There are two main advantages to adding information to the .so or .pyd file about what version of Python it was compiled against:
The change to the file name affects all compiled Python modules, not just Cython.
This question describes how to change the identifier that's added - there is rarely a good reason for doing so, however.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With