cython Getting started with cython Installing Cython


To use Cython two things are needed.The Cython package itself, which contains the cython source-to-source compiler and Cython interfaces to several C and Python libraries (for example numpy). To compile the C code generated by the cython compiler, a C compiler is needed.

Step 1: Installing Cython

System Agnostic

Cython can be installed with several system agnostic package management systems. These include:

  1. PyPI via pip or easy_install:

    $ pip install cython
    $ easy_install cython
  2. anaconda using conda:

    $ conda install cython
  3. Enthought canopy using the enpkg package manager:

    $ enpkg cython

Also the source code can be downloaded from github and installed manually using:

$ python install

Ubuntu, Debian

For Ubuntu the packages cython and cython3 are available. Note that these provide an older version than the installation options mentioned above.

$ apt-get install cython cython3


For Windows, a .whl file that can be installed using pip is provided by a third party. Details on installing a .whl file on Windows can be found here.

Step 2: Installing a C Compiler

To compile the C files generated by Cython, a compiler for C and C++ is needed. The gcc compiler is recommended and can be installed as follows.

Ubuntu, Debian

The build-essential package contains everything that is needed. It can be installed from the repositories using:

$ sudo apt-get install build-essential


The XCode developer tools contain a gcc like compiler.


MinGW (Minimalist GNU for Windows) contains a Windows version of gcc. The compiler from Visual Studio can also be used.