将cython构建到cpp时找不到pxd

时间:2016-04-13 03:23:35

标签: python cython

我有一个像这样的目录结构:

h = Hash.new{|_, k| k}
h["a"] # => "a"

project/lib/src/a.pyx project/lib/src/<some other files> project/helpers/cython/b.pyx project/helpers/cython/b.pxd project/helpers/cython/setup.py project/helpers/cython/__init__.py 看起来像这样:

project/helpers/cython/setup.py

from distutils.core import setup from Cython.Build import cythonize setup( ext_modules=cythonize("helpers/cython/b.pyx"), ) 中,我有以下几行:

a.pyx

import helpers.cython.b as utils cimport helpers.cython.b as utils_c 时,我跑了 project/lib/,我收到错误消息

cython src/*.pyx srsc/*.pxd -a --cplus

当我没有import helpers.cython.b as utils cimport helpers.cython.b as utils_c ^ ------------------------------------------------------------ a.pyx:29:8: 'helpers/cython/b.pxd' not found 行时,cython找到正确的目录没有问题。

关于我做错了什么的想法?我试图按照文档中给出的示例进行设置,但没有成功。

谢谢!

1 个答案:

答案 0 :(得分:1)

我有类似的问题。尝试让cython通过project访问您的include_dirs目录,如下所示:

cython src/*.pyx srs/*.pxd -a --cplus --include-dir ../