0

我在构建 PIRT(Python 图像注册工具包库)时遇到问题。我使用 mercurial ( hg clone https://bitbucket.org/almarklein/pirt) 从 bitbucket 下载。但是当我尝试使用它来构建它时python setup.py,出现以下错误:

Compiling pirt/splinegrid_.pyx because it changed.
[1/2] Cythonizing pirt/interp/interpolation_.pyx

Error compiling Cython file:
------------------------------------------------------------
...

    # Methods
    cdef void calculate_lut(self, spline_type, int N)
    cdef double* get_coef(self, double t) nogil
    cdef double* get_coef_from_index(self, int i)    
    cdef double spline_type_to_id(self, spline_type)
                                ^
------------------------------------------------------------

pirt/interp/interpolation_.pxd:23:33: C method 'spline_type_to_id' is declared but not defined
Traceback (most recent call last):
  File "setup.py", line 49, in <module>
    extensions = cythonize(extensions)
  File "/home/osboxes/anaconda3/lib/python3.5/site-packages/Cython/Build/Dependencies.py", line 877, in cythonize
    cythonize_one(*args)
  File "/home/osboxes/anaconda3/lib/python3.5/site-packages/Cython/Build/Dependencies.py", line 997, in cythonize_one
    raise CompileError(None, pyx_file)
Cython.Compiler.Errors.CompileError: pirt/interp/interpolation_.pyx

我已经安装了 Cython 和 visvis(通过 Anaconda),但构建仍然失败。

4

1 回答 1

1

不幸的是,我找不到关于应该在文件中声明函数的确切部分的.pxd文档。值得庆幸的是,人们可以查看现有的Cython/Includes并得出结论。

简而言之,将定义更改为pirt/interp/interpolation_.pxd

cdef double spline_type_to_id(self, spline_type)

至:

cdef double spline_type_to_id(self, spline_type) except *

setup.py再次运行。

于 2016-05-30T17:50:05.217 回答