filename_setup.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#filename_setup.py
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext as build_pyx
setup(name = 'filename', ext_modules=[Extension('filename', ['filename.pyx'])], cmdclass = { 'build_ext': build_pyx })
$ cp filename.py filename.pyx
$ Cython filename.pyx
$ python filename_setup.py build
$ python
\ # By the way, if you specify the variable type using cdef in pyx before Cython above, it will be even faster.
>> import pyximport; pyximport.install()
>> import filename
Easy and easy
Cython: C-Extensions for Python
Recommended Posts