C++ makefiles:python 3.9的-lpython2.7等效是什么(即python3库在哪里?)
我正在尝试编译一些使用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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它与 C++ 或 makefile 没有太大关系,但与传统的 Python 3.9 安装类似,
-lpython2.7
是-lpython3.9
。这几乎肯定是该库位于适用的库搜索路径之外的标志,而不是您有不合适的
-l 选项通常可以通过在命令行中使用 -L/path/to/directory/of/libpython 选项来解决。
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
.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.