cython
基本
端末上で使う場合
- hoge.pyxでPythonプログラムを書く。
- 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("hoge", ["hoge.pyx"])] )
- Cythonをビルド。
$ python setup.py build_ext --inplace
Jupyter notebookで使う場合
一行目に
%load_ext Cython
使用したいコードの一行目に
%%cython
Keyword(s):
References: