举例 输出“hello world”
1.创建 example.c
#include<Python.h>
PyObject *shuchu()
{
printf("hello world");
}
2.把test.c编译成so库
gcc -fPIC -shared example.c -o example.so -l /usr/.../ -I /usr/.../
3.新建python脚本 test.py
#!/usr/bin/python
import example
example.shuchu()
4.运行python脚本
python test.py
完!