c/c++语言开发共享嵌入Python 3.3

我尝试嵌入Python 3.3,如此处所述。

我在使用Python 2.7的MacOS 10.8上,所以我从python.org下载了3.3版的二进制发行版。 从它我得到了所有标题和“Python”,我重命名为“python33”所以它不会与安装的“Python”lib发生冲突。 我把所有东西放到一个文件夹中

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  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 

请问,有谁知道如何编译?

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

    首先和formost,库必须以’libxxx.so’的forms命名,然后链接器将使用’-L找到它。 -lxxx”。

    即使这样,由此产生的可执行文件也不会起作用,因为必须复制/创建库而不是整个框架。

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

      以上就是c/c++开发分享嵌入Python 3.3相关内容,想了解更多C/C++开发(异常处理)及C/C++游戏开发关注计算机技术网(www.ctvol.com)!)。

      本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。

      ctvol管理联系方式QQ:251552304

      本文章地址:https://www.ctvol.com/c-cdevelopment/522464.html

      (0)
      上一篇 2020年12月10日
      下一篇 2020年12月10日

      精彩推荐