O'Reilly logo

Learning Cython Programming by Philip Herron

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Hello World

Hopefully by now you've got Cython down and compiled and installed it. Let's check this by running the following command:

$ cython --version

Let's do a sanity test and run the typical "Hello World" program:

redbrain@gamma:~/workspace/cython-book/chapter1/helloworld$ make

We have now created the Cython helloworld.so module! You can see it within Python (make sure you are in the same directory as the helloworld.so module):

redbrain@gamma:~/workspace/cython-book/chapter1/helloworld$ python
Python 2.7.3 (default, Aug  1 2012, 05:16:07)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import helloworld
Hello World from cython!

We import helloworld since this module is now a valid Python module ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required