CGo调用CPython的巨坑

158 阅读1分钟

改了我一下午,说实话,Python真巨坑 生成的Python的pkg-config的pc文件一定要修改

  • 源文件缺失Libs文件和链接-lpython3.10
# See: man pkg-config
prefix=/Library/Frameworks/Python.framework/Versions/3.10
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: Python
Description: Build a C extension for Python
Requires:
Version: 3.10
Libs.private: -ldl   -framework CoreFoundation
Libs: -L${libdir} -lpython3.10
Cflags: -I${includedir}/python3.10