当前位置:   article > 正文

missing: PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS

python_include_dirs

Opencv 3.x (missing: PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS)

ImportError: No module named numpy.distutils
-- Found PythonInterp: /home/satur/anaconda3/bin/python3 (found suitable version "3.6.4", minimum required is "3.4") 
-- Could NOT find PythonLibs (missing:  PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS) (Required is exact version "3.6.4")
-- Looking for ccache - not found
  • 1
  • 2
  • 3
  • 4

原因:Linux下安装opencv-3.4.1cmake的时候没有找到python的PYTHON_INCLUDE_DIRSPYTHON_LIBRARIES位置
解决: 使用-DPYTHON_INCLUDE_DIR 来指明位置,如下所示

cmake .. \
-DPYTHON_INCLUDE_DIR=$(python -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())")  \
-DPYTHON_LIBRARY=$(python -c "import distutils.sysconfig as sysconfig; print(sysconfig.get_config_var('LIBDIR'))")
  • 1
  • 2
  • 3

如果是系统自带python2,但是使用都是anaconda的python3,只需要指明是python3 -c, 如下

cmake .. \
-DPYTHON_INCLUDE_DIR=$(python3 -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())")  \
-DPYTHON_LIBRARY=$(python3 -c "import distutils.sysconfig as sysconfig; print(sysconfig.get_config_var('LIBDIR'))")
  • 1
  • 2
  • 3

出处 Stackoverflow Cmake is not able to find Python-libraries

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/2023面试高手/article/detail/119813
推荐阅读
相关标签
  

闽ICP备14008679号