Linux command
cythonize 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Compile Cython file
cythonize -i [module.pyx]
Compile with build directory
cythonize -b [module.pyx]
Compile multiple files
cythonize -i [*.pyx]
Compile with parallelism
cythonize -j [4] -i [module.pyx]
Force recompilation
cythonize -f -i [module.pyx]
Annotate with HTML
cythonize -a [module.pyx]
说明
cythonize compiles Cython source files (.pyx) into C extension modules. Cython is a superset of Python that enables C-level performance through static typing and direct C API access. The tool handles the full compilation pipeline: generating C code, compiling with a C compiler, and building importable Python modules.
参数
- -i, --inplace
- Build extensions in place.
- -b, --build
- Build using temporary build directory.
- -j _n_
- Parallel compilation jobs.
- -f, --force
- Force recompilation.
- -a, --annotate
- Generate HTML annotation.
- -3
- Use Python 3 syntax.
- -X _directive_
- Set Cython directive.
- -s _option_
- Set compiler option.
- --cplus
- Generate C++ code.
FAQ
What is the cythonize command used for?
cythonize compiles Cython source files (.pyx) into C extension modules. Cython is a superset of Python that enables C-level performance through static typing and direct C API access. The tool handles the full compilation pipeline: generating C code, compiling with a C compiler, and building importable Python modules.
How do I run a basic cythonize example?
Run `cythonize -i [module.pyx]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -i, --inplace do in cythonize?
Build extensions in place.