Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ethen8181
GitHub Repository: ethen8181/machine-learning
Path: blob/master/python/cython/setup.py
2574 views
1
# compiling the .pyx module
2
import numpy as np
3
from distutils.core import setup
4
from Cython.Build import cythonize
5
6
# key-value pairs that tell disutils the name
7
# of the application and which extensions it
8
# needs to build
9
# 1. for the cython modules, we're using glob patterns
10
# e.g. '*.pyx' for every .pyx file or simply pass in
11
# a list of the filename.pyx
12
# 2. include_dirs, makes sure we can compile against numpy
13
# Extension modules that need to compile against NumPy should use this
14
# function to locate the appropriate include directory
15
# http://nullege.com/codes/search/numpy.get_include
16
setup(
17
name = 'Hello',
18
ext_modules = cythonize(['helloworld.pyx', 'pairwise1.pyx', 'pairwise2.pyx']),
19
include_dirs = [np.get_include()]
20
)
21
22
# after that run
23
# python setup.py build_ext --inplace
24
# in the command line, and we can import it like
25
# normal python modules
26
27