My Cython (.pyx
) file contains assert
and I would like to remove it when I compile the file. I found this post and edited my setup.py
as follows.
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
# Before edit
compiler_args = ["-O3", "-ffast-math"]
# Both did not work
# compiler_args = ["-O3", "-ffast-math", "-DPYREX_WITHOUT_ASSERTIONS"]
# compiler_args = ["-O3", "-ffast-math", "-CYTHON_WITHOUT_ASSERTIONS"]
ext_modules = [
Extension("mycython", sources=["mycython.pyx"],
extra_compile_args=compiler_args)
]
setup(
name="Test",
cmdclass={'build_ext': build_ext},
ext_modules=ext_modules
)
The error says:
clang: error: unknown argument: '-CYTHON_WITHOUT_ASSERTIONS'
How can I fix it?