.pxd文件的未知文件类型错误

时间:2016-01-07 11:36:56

标签: python cython

我尝试在Kubuntu 14.04上为python安装triangle。如果我尝试通过easy_install或从源安装它,我收到以下错误:

sudo easy_install triangle
Processing triangle
Writing /home/magnus/triangle/setup.cfg
Running setup.py -q bdist_egg --dist-dir /home/magnus/triangle/egg-dist-tmp-sJ6dHl
Searching for setuptools>=18.0
Best match: setuptools 19.2
Processing setuptools-19.2-py2.7.egg

Using /home/magnus/triangle/setuptools-19.2-py2.7.egg
/home/magnus/triangle/core.pyx:5:35: Expected an identifier or literal
error: Setup script exited with error: unknown file type '.pxd' (from 'triangle/c_triangle.pxd')

这似乎是this question中提到的类似问题,但我无法弄清楚如何修复它。我的Cython版本是:

cython --version
Cython version 0.20.1post0

有人知道如何解决这个问题吗?任何帮助都非常感谢。

2 个答案:

答案 0 :(得分:3)

我也遇到了这个错误,并按照以下步骤解决了这个问题:

  1. 克隆三角包的git存储库:

    git clone https://github.com/drufat/triangle.git

  2. 安装最新的Cython(版本== 0.23)

  3. 在setup.py中,搜索关键字Cython并将其版本要求更改为> = 0.23。

  4. 运行python setup.py install

答案 1 :(得分:3)

在xubuntu 14.04上的虚拟环境中安装三角形包时遇到了同样的问题。我通过以下方式解决了这个问题:

  1. 升级setuptools(至19.4版)
    pip install --upgrade setuptools
    
  2. 安装三角形
    pip install triangle
    
  3. 我的cython(版本0.23.4)是使用

    安装的
    pip install --upgrade cython