CMake 在构建 OpenCV 时找不到 PythonLibs [英] CMake can not find PythonLibs while building OpenCV

查看:104
本文介绍了CMake 在构建 OpenCV 时找不到 PythonLibs的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我试图为 arm 设备交叉编译 OpenCV,在运行 cmake 时,我注意到在输出中没有找到 PythonLibs.我的系统中同时安装了 Python2 和 Python3 库.

so Im trying to cross-compile OpenCV for an arm device and while running cmake, I noticed in the output that the PythonLibs were not found. I have both Python2 and Python3 libs installed in my system.

这是输出

-- 找到 PythonInterp:/usr/bin/python2.7(找到合适的版本2.7.12",最低要求是2.7")

-- Found PythonInterp: /usr/bin/python2.7 (found suitable version "2.7.12", minimum required is "2.7")

-- 找不到 PythonLibs(缺少:PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS)(需要精确的版本2.7.12")

-- Could NOT find PythonLibs (missing: PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS) (Required is exact version "2.7.12")

-- 找到 PythonInterp:/usr/bin/python3(找到合适的版本3.5.2",最低要求是3.4")

-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.5.2", minimum required is "3.4")

-- 找不到 PythonLibs(缺少:PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS)(需要确切的版本3.5.2")

-- Could NOT find PythonLibs (missing: PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS) (Required is exact version "3.5.2")

在输出结束时,我也注意到了这一点

Towards the end of the output, I also noticed this

Python 2:

解释器:/usr/bin/python2.7 (ver 2.7.12)

Interpreter: /usr/bin/python2.7 (ver 2.7.12)

Python 3:

解释器:/usr/bin/python3 (ver 3.5.2)

Interpreter: /usr/bin/python3 (ver 3.5.2)

Python(用于构建):/usr/bin/python2.7

Python (for build): /usr/bin/python2.7

由此我可以得出结论,未构建 Python 绑定.如果有人对我如何解决这个问题有任何建议,我很乐意倾听.

From this I could conclude that the Python bindings were not built. If someone had any suggestion on how I can fix this, I would be happy to listen.

推荐答案

你正在尝试编译一些简单的请求 DEV 包的东西,你只有 Python 解释器包,在 Raspberry PI 中你必须有 python-devpython3-dev 为例,如果你使用的是树莓派尝试运行:

You are trying to compile something that is simple requesting the DEV packages, you have only the Python interpreters packages, in Raspberry PI you must have python-dev and python3-dev for example, if you are using Raspberry PI try to run:

sudo apt-get install -y python-dev python3-dev

然后你会通过这一步,如果有其他错误再发新帖.

Then you will pass this step, if there come another errors make new posts.

关于如何为 Raspberry PI 编译 OpenCV 的一个很好的简单教程,您可以在这里找到:https:///www.pyimagesearch.com/2016/04/18/install-guide-raspberry-pi-3-raspbian-jessie-opencv-3/

A good and simple tutorial on how to compile OpenCV for Raspberry PI you found here: https://www.pyimagesearch.com/2016/04/18/install-guide-raspberry-pi-3-raspbian-jessie-opencv-3/

这篇关于CMake 在构建 OpenCV 时找不到 PythonLibs的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆