In order to use Cython, we need to install it. The Enthought Canopy, Anaconda, and Sage distributions include Cython. For more information, see https://www.enthought.com/products/canopy/, https://store.continuum.io/cshop/anaconda/, and http://sagemath.org/. We will not discuss here how to install these distributions. Obviously, we need a C compiler to compile the generated C code. On some operating systems such as Linux, the compiler will already be present. In this recipe, we will assume that you already have the compiler installed.
We can install Cython using any of the following methods:
Install Cython from a source archive by performing the following steps:
Download a source archive from http://cython.org/#download.
Unpack it.
Browse to the directory using the
cd
command.Run the following command:
$ python setup.py install
Install Cython from the PyPI repository with any one of these commands:
$ easy_install cython $ sudo pip install cython