C++ makefiles:python 3.9的-lpython2.7等效是什么(即python3库在哪里?)

发布于 2025-01-17 14:22:58 字数 626 浏览 0 评论 0原文

我正在尝试编译一些使用matplotlibcpp的C ++代码,并且我的时间很困难。在我的makefile中,我正在按照matplotlibcpp文档上的示例并添加一个-lpython3.9标志(我使用的是python 3.9,因为我的mac python2.7不允许我链接-lpython2.7)。 When I try to compile I get an error stating:

""ld: library not found for -lpython3.9"

I would like to know what the correct library name I need to use is so I can have access to python 3.9.

For context I am using clang++ and python 3.9 installed using homebrew

PS: I searched in my Versions/3.9/lib folder and it has a file called "libpython3.9.dylib" which seems like it might be what I want but I dont know how to以同样的方式包括-lpython3.9。

I am trying to compile some c++code that uses matplotlibcpp and I am having quite a difficult time. In my makefile, I am following the example on the matplotlibcpp documentation and adding a -lpython3.9 flag (I am using python 3.9 because my macs python2.7 doesnt allow me to link -lpython2.7).
When I try to compile I get an error stating:

""ld: library not found for -lpython3.9"

I would like to know what the correct library name I need to use is so I can have access to python 3.9.

For context I am using clang++ and python 3.9 installed using homebrew

PS: I searched in my Versions/3.9/lib folder and it has a file called "libpython3.9.dylib" which seems like it might be what I want but I dont know how to include it that same way I would -lpython3.9.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夏见 2025-01-24 14:22:58

Python 3.9 的 -lpython2.7 等效项是什么(即 python3 库在哪里?)

它与 C++ 或 makefile 没有太大关系,但与传统的 Python 3.9 安装类似, -lpython2.7-lpython3.9

当我尝试编译时,出现错误:

“ld:找不到-lpython3.9的库”

这几乎肯定是该库位于适用的库搜索路径之外的标志,而不是您有不合适的 -l 选项通常可以通过在命令行中使用 -L/path/to/directory/of/libpython 选项来解决。

What is the equivalent of -lpython2.7 for python 3.9 (ie where is the python3 library?)

It doesn't have much to do either with C++ or with makefiles, but with a conventional Python 3.9 installation, the analogue of -lpython2.7 is -lpython3.9.

When I try to compile I get an error stating:

""ld: library not found for -lpython3.9"

That is almost certainly a sign that the library is outside the applicable library search path, not that you have an inappropriate -l option. You would typically resolve that by using an -L/path/to/directory/of/libpython option earlier on the command line.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文