其实主要是复习gcc的用法
#include <Python.h>
int main(void){ Py_Initialize(); PyRun_SimpleString("from time import time,ctime\n" "print 'Today is',ctime(time()\n)"); Py_Finalize(); return 1;
}
|
假定python2.4安装在/opt/python目录下
gcc -I/opt/python/include/python2.4 -L/opt/python/lib -lpython2.4 -o test_py test_py.c
阅读(472) | 评论(0) | 转发(0) |