9

I have a code snippet, called 'test.pyx':

import numpy as np
cimport numpy as np

print(np.arange(10))

And then I wrote two setup.py to compile them. The first one worked fine:

from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
import numpy as np

extensions = [
    Extension('test', ['test.pyx'], include_dirs = [np.get_include()]),
    ]

setup(
    ext_modules = cythonize(extensions)
    )

And this one did not work (which is also from an example on http://docs.cython.org/src/reference/compilation.html):

from distutils.core import setup
from Cython.Build import cythonize
import numpy as np


setup(
    ext_modules = cythonize('./test.pyx', include_path=[np.get_include()])
    )

It says: ./test.c(346) : fatal error C1083: Cannot open include file: 'numpy/arrayobject.h': No such file or directory.

I am using Python 3.3 64-bit on Windows 64-bit, with WinSDK 7.1.

Yuxiang Wang
  • 8,095
  • 13
  • 64
  • 95

1 Answers1

3

This is a Cython documentation bug, see also https://github.com/cython/cython/issues/1480