.pxd 文件出现未知文件类型错误

Unknown file type error with .pxd file

我尝试在 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

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

我也有这个错误,并通过以下步骤解决了它:

  1. 克隆三角包的git仓库:

    git 克隆 https://github.com/drufat/triangle.git

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

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

  4. 运行 python setup.py 安装

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

  1. 通过

    升级设置工具(到版本 19.4)
    pip install --upgrade setuptools
    
  2. 通过

    安装三角形
    pip install triangle
    

我的 cython(版本 0.23.4)是使用

安装的
pip install --upgrade cython