Skip to main content
 首页 » 编程设计

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

2025年05月04日16jillzhang

我尝试安装 triangle适用于 Kubuntu 14.04 上的 python。如果我尝试通过 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 install