【问题标题】:"Could NOT find PythonLibs" in conda environment在 conda 环境中“找不到 PythonLibs”
【发布时间】:2021-01-12 22:37:28
【问题描述】:

尽管能够找到我的 python 可执行文件,但 CMake 找不到我的 python 库目录。因此,它只为我的系统 python2 而不是为我的环境构建的 python3。

-- Found PythonInterp: /usr/bin/python2.7 (found suitable version "2.7.18", minimum required is "2.7") 
-- Found PythonLibs: /home/<user>/.conda/envs/confpaint/lib/libpython3.8.so (found suitable exact version "2.7.18") 
-- Found PythonInterp: /home/<user>/.conda/envs/confpaint/bin/python3 (found suitable version "3.8.6", minimum required is "3.2") 
-- Could NOT find PythonLibs (missing: PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS) (Required is exact version "3.8.6")

...

    --   Python 2:
    --     Interpreter:                 /usr/bin/python2.7 (ver 2.7.18)
    --     Libraries:                   /home/<user>/.conda/envs/confpaint/lib/libpython3.8.so (ver 2.7.18)
    --     numpy:                       /home/<user>/.local/lib/python2.7/site-packages/numpy/core/include (ver 1.14.5)
    --     install path:                lib/python2.7/site-packages/cv2/python-2.7
    -- 
    --   Python (for build):            /home/<user>/.conda/envs/confpaint/bin/python3

【问题讨论】:

    标签: python cmake anaconda conda


    【解决方案1】:

    您需要指定与您的 python 版本相对应的 cmake 包含和库目录的位置。例如,这是我的样子:

    cmake -DPYTHON3_LIBRARY=/home/<user>/.conda/envs/confpaint/lib/libpython3.8.so \
          -DPYTHON3_INCLUDE_DIRS=/home/<user>/.conda/envs/confpaint/include/python3.8 \
          -DPYTHON_DEFAULT_EXECUTABLE=/home/<user>/.conda/envs/confpaint/bin/python3 ..
    

    【讨论】:

      猜你喜欢
      • 2020-02-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-08-18
      • 1970-01-01
      • 2021-08-17
      • 2017-11-19
      • 2020-04-08
      相关资源
      最近更新 更多