简体   繁体   English

在PHP中使用经过编译的python的Cython扩展?

[英]Use a Cython extension from a compiled python in php?

Can this be done? 能做到吗?

No idea if the Cython .so extension can be dynamic loaded from a php script or does it needs any extra manage? 不知道Cython .so扩展名是否可以从php脚本动态加载,还是需要任何额外的管理?

The short answer is no. 最简洁的答案是不。 Cython extensions use the Python C API, so they can't be loaded and called directly from PHP. Cython扩展使用Python C API,因此无法直接从PHP加载和调用它们。 They will typically take and return PyObject structs as arguments (Python objects). 它们通常将PyObject结构作为参数返回(Python对象)。 You'll need a Python <-> PHP binding to load the .so and do object conversion. 您将需要Python <-> PHP绑定来加载.so并进行对象转换。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM