我在使用将矢量类导入 cython 时遇到问题
from libcpp.vector cimport vector
当我添加这个并尝试编译我得到的 pyx 文件时
python setup.py build_ext --inplace
running build_ext
skipping 'kmc_cy.c' Cython extension (up-to-date)
building 'kmc_cy' extension
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -fPIC -I/usr/include/python2.7 -c kmc_cy.c -o build/temp.linux-x86_64-2.7/kmc_cy.o
kmc_cy.c:254:18: fatal error: vector: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
这是我的 setup.py
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import sys
sys.path.append("/usr/lib64/python2.7/site-packages/Cython/Includes/libcpp")
ext_modules = [Extension("kmc_cy", ["kmc_cy.pyx"])]
setup(
name = 'kmc_cy',
cmdclass = {'build_ext': build_ext},
ext_modules = ext_modules,
)
干杯