Learn Before
Code
Cython Example
Create a file named helloworld.pyx:
def example(): print("Hello World")
Create a file called setup.py:
from setuptools import setup from Cython.Build import cythonize setup(ext_modules = cythonize("helloworld.pyx"))
To compile and build the Cython file:
setup.py build_ext --inplace
You can now use your compiled Python extension via:
import helloworld helloworld.example()
0
1
Updated 2021-03-24
Tags
Python Programming Language
Data Science