【发布时间】:2013-02-21 16:26:25
【问题描述】:
我尝试嵌入 Python 3.3,如 here 所述。
我使用的是具有 Python 2.7 的 MacOS 10.8,因此我从 python.org 下载了 3.3 版的二进制分发版。从中我得到了所有标题和“Python”,我将它们重命名为“python33”,因此它不会与已安装的“Python”库发生冲突。我把所有东西都放到一个文件夹里:
embed.c /include python33
“文件python33”说:
python33 (for architecture i386): Mach-O dynamically linked shared library i386
python33 (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64
而 embed.c 是:
#include <Python.h>
int
main(int argc, char *argv[])
{
Py_Initialize();
PyRun_SimpleString("print 'test'\n");
Py_Finalize();
return 0;
}
但是当我执行“gcc embed.c -I./include -L.-lpython33”时,它会中断:
ld: library not found for -lpython33
请问有谁知道怎么编译?
【问题讨论】:
标签: python c python-3.x linker embedding