Cython dynamic library problem

Rob Wolfe rw at
Thu Sep 18 18:35:09 CEST 2008

Tommy Grav <tgrav at> writes:

> I am trying to learn how to use cython, and while I am following the
> cython-dev
> mailing list I didn't feel like this question was totally appropriate
> for its audience
> so I am trying here first.


> Does anyone know what the ImportError means and how to correct it?

I would try to use `distutils` because this package is much wiser
than me and knows all necessary switches for gcc. ;)

# test_cython.pyx
def test(x):
    return x * x

from pyx_test import test

print test(0)
print test(10)

from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext as build_pyx

setup(name = 'pyx_test',
      ext_modules=[Extension('pyx_test', ['test_cython.pyx'])],
      cmdclass = { 'build_ext': build_pyx })

$ python2.5 build_ext -i
running build_ext
cythoning test_cython.pyx to test_cython.c
building 'pyx_test' extension
creating build/temp.linux-i686-2.5
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.5 -c test_cython.c -o build/temp.linux-i686-2.5/test_cython.o
test_cython.c:86: warning: function declaration isn’t a prototype
test_cython.c:241: warning: function declaration isn’t a prototype
test_cython.c:59: warning: ‘__pyx_skip_dispatch’ defined but not used
gcc -pthread -shared -Wl,-O1 build/temp.linux-i686-2.5/test_cython.o -o
$ python2.5


More information about the Python-list mailing list