[英]python/cython compiling pyx: fatal error: capsule.h: No such file or directory
I recently worked on a python project where I need to import some .pyx
files. 我最近在一个python项目中工作,我需要导入一些.pyx
文件。
However, I had a hard time import it as .pyx
and compile it with the following lines: 但是,我很难将其导入为.pyx
并使用以下几行进行编译:
import pyximport
pyximport.install()
from . import kl
The error is 错误是
fatal error: capsule.h: No such file or directory
And in the kl.pyx
file, capsule.h
is used as following: 而在kl.pyx
文件, capsule.h
用作以下几点:
cdef extern from "capsule.h":
void* Capsule_AsVoidPtr(object ptr)
I am not sure what I should do. 我不确定该怎么办。 Please help me a little bit. 请帮我一点。
Alternatively , is it possible that the python script could import compiled .c
(in Linux) file directly, instead of importing .pyx
and compile it? 或者 ,python脚本是否可以直接导入已编译的.c
(在Linux中)文件,而不是导入.pyx
进行编译? When I compile it with command line, it is compiled successfully, but I don't know how my IDE (PyCharm) could import that .c
file. 当我使用命令行编译它时,它已成功编译,但是我不知道我的IDE(PyCharm)如何导入该.c
文件。
Thank you very much. 非常感谢你。
您错过了一些库,需要安装capsule.h的源代码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.