0

I try to embed Python 3.3, as described here.

I'm on MacOS 10.8 which has Python 2.7 so I downloaded binary distribution of version 3.3 from python.org. From it I got all the headers and "Python" which I renamed to "python33" so it wont collide with installed "Python" lib. I put everything into a folder:

embed.c /include python33

"file python33" says:

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

and embed.c is:

#include <Python.h>

int
main(int argc, char *argv[])
{
  Py_Initialize();
  PyRun_SimpleString("print 'test'\n");
  Py_Finalize();
  return 0;
}

But when I do "gcc embed.c -I./include -L. -lpython33" it breaks with:

ld: library not found for -lpython33

Please, does anyone know how to make it compile?

4

2 回答 2

0

首先,该库必须以“libxxx.so”的形式命名,然后链接器将使用“-L”找到它。-lxxx'。

即使那样,生成的可执行文件也无法工作,因为人们不仅要复制/创建库,还要复制/创建整个框架。

更多信息:http: //lists.apple.com/archives/cocoa-dev/2013/Feb/msg00522.html

于 2013-02-25T17:34:01.107 回答
0

运行python3.3-config --cflags,您将获得系统所需的 cflags。对于 ldflags,命令是python3.3-config --ldflags

于 2013-02-21T16:31:32.083 回答