设为首页 加入收藏

TOP

Ubuntu 10.04下C程序中集成Python
2014-11-24 03:00:52 来源: 作者: 【 】 浏览:2
Tags:Ubuntu 10.04 程序 集成 Python

#include
#include
int main(int argc, char * argv[])
{
// initialize the interpreter
Py_Initialize();
// eva luate some code
PyRun_SimpleString("import sys\n");
//ignore line wrap on following line
PyRun_SimpleString("sys.stdout.write('Hello from an embedded Python Script\\n')\n");
// shut down the interpreter
Py_Finalize();
return 0;
}


$gcc Listing1.c -I/usr/include/python2.6 -lpython2.6


编译成.so


$gcc -c -fPIC Listing2.c -I/usr/include/python2.6
$gcc -shared Listing2.o -o libcrypto.so -lpython2.6


】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇Android系统中捕获鼠标事件 下一篇Linux设备驱动程序之字符设备驱

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·在 C 语言函数中,如 (2025-12-24 12:19:41)
·C盘里面的AppData文 (2025-12-24 12:19:38)
·c语言中的“%d,%s,%c (2025-12-24 12:19:35)
·Sphinx : 高性能SQL (2025-12-24 10:18:11)
·Pandas 性能优化 - (2025-12-24 10:18:08)