赞
踩
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
原因:Linux下安装opencv-3.4.1
在cmake
的时候没有找到python的PYTHON_INCLUDE_DIRS
与PYTHON_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'))")
如果是系统自带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'))")
出处 Stackoverflow Cmake is not able to find Python-libraries
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。