gpt4 book ai didi

python - 链接 : fatal error LNK1104: cannot open file 'python38.lib' with CMake finding library

转载 作者:行者123 更新时间:2023-12-03 19:13:44 25 4
gpt4 key购买 nike

我正在尝试将 python 库链接到 CMake 目标并从中构建模块(使用 Boost.Python3)。 CMake 正确找到 Boost.Python3 和 Python3,但是在链接时,我收到错误 LINK : fatal error LNK1104: cannot open file 'python38.lib'
我添加了正确的 python38.lib到我的 PATH(和 LIBPATH),并且 CMake 正确找到了库:

message(STATUS "Python3_LIBRARIES = ${Python3_LIBRARIES}")

结果是
-- Python3_LIBRARIES = optimized;C:/Program Files/Python38/libs/python38.lib;debug;C:/Program Files/Python38/libs/python38_d.lib

我链接了所有的库:
  target_link_libraries(trgt PRIVATE
${Boost_LIBRARIES}
${Python3_LIBRARIES}
Python3::Python # tried with and without this line
trgtCore)

我正在编译 $ cmake .. "-GVisual Studio 16 2019" -A x64这与我的 Python 3.8 的 x64 安装相匹配。

最佳答案

从 github 安装 opencv 版本 4 时我遇到了同样的问题,我通过将 .lib 文件复制到 Visual Studio 项目中解决了这个问题。
希望能帮助到你,
阿马尔。

关于python - 链接 : fatal error LNK1104: cannot open file 'python38.lib' with CMake finding library,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61311349/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com