Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

If you have a pyx file you can compile it in the terminal and create a library first and then import the library

cython filename.pyx
gcc -O3 -I/usr/include/python2.6/ -I/Library/Python/2.6/site-packages/numpy-2.0.0.dev_f72c605_20110113-py2.6-macosx-10.6-universal.egg/numpy/core/include/ -c -o filename.o filename.c
gcc -dynamiclib -undefined dynamic_lookup -single_module -o filename.so filename.o

for Mac. For Linux use

cython -a filename.pyx
gcc -shared -pthread -fPIC -fwrapv -O2 -Wall -fno-strict-aliasing -I/usr/include/python2.5 -o filename.so filename.c

Depending on what the path of the module is you may have to add the following lines in the beginning

import sys
sys.path.append('path-to-module')

Then you can import modules.