使用gcc编译cython:#include“ ios”中没有此类文件或目录 [英] Compiling cython with gcc: No such file or directory from #include "ios"

查看:305
本文介绍了使用gcc编译cython:#include“ ios”中没有此类文件或目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从spacy.structs cimport给出文件 docprep.pyx 简单

Given a file docprep.pyx as simple as

from spacy.structs cimport TokenC

print("loading")

并尝试通过

cythonize -3 -i docprep.pyx

我收到以下错误消息

docprep.c:613:10: fatal error: ios: No such file or directory
 #include "ios"
          ^~~~~
compilation terminated

如您所知,该系统带有Python 3.7的Anaconda安装。 numpy spacy cython 均通过<$安装c $ c> conda 。

As you can tell from the paths, this system has an Anaconda installation with Python 3.7. numpy, spacy and cython are all installed through conda.

推荐答案

就我而言,它使用@mountrix技巧工作,将 language = c ++ 添加到setup.py中,例如:

In my case, it worked using @mountrix tip, just add the language="c++" to your setup.py, an example:

from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
import numpy


extensions = [
    Extension("processing_module", sources=["processing_module.pyx"], include_dirs=[numpy.get_include()], extra_compile_args=["-O3"], language="c++")
]

setup(
    name="processing_module",
    ext_modules = cythonize(extensions),
)

这篇关于使用gcc编译cython:#include“ ios”中没有此类文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆