简体   繁体   English

CMake在构建OpenCV时找不到PythonLib

[英]CMake can not find PythonLibs while building OpenCV

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. 所以我试图交叉编译用于手臂设备的OpenCV并在运行cmake时,我在输出中注意到未找到PythonLib。 I have both Python2 and Python3 libs installed in my system. 我的系统中同时安装了Python2和Python3库。

Here is the output 这是输出

-- Found PythonInterp: /usr/bin/python2.7 (found suitable version "2.7.12", minimum required is "2.7") -找到PythonInterp:/usr/bin/python2.7(找到合适的版本“ 2.7.12”,最低要求为“ 2.7”)

-- Could NOT find PythonLibs (missing: PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS) (Required is exact version "2.7.12") -找不到PythonLib(缺少:PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS)(需要的是确切的版本“ 2.7.12”)

-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.5.2", minimum required is "3.4") -找到PythonInterp:/ usr / bin / python3(找到合适的版本“ 3.5.2”,最低要求为“ 3.4”)

-- Could NOT find PythonLibs (missing: PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS) (Required is exact version "3.5.2") -找不到PythonLib(缺少:PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS)(要求的是确切的版本“ 3.5.2”)

Towards the end of the output, I also noticed this 在输出即将结束时,我也注意到了这一点

Python 2: Python 2:

Interpreter: /usr/bin/python2.7 (ver 2.7.12) 口译员:/usr/bin/python2.7(版本2.7.12)

Python 3: Python 3:

Interpreter: /usr/bin/python3 (ver 3.5.2) 口译员:/ usr / bin / python3(版本3.5.2)

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

From this I could conclude that the Python bindings were not built. 由此我可以得出结论,没有构建Python绑定。 If someone had any suggestion on how I can fix this, I would be happy to listen. 如果有人对如何解决此问题有任何建议,我很乐意听。

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: 您正在尝试编译一些简单的请求DEV包的内容,只有Python解释器包,例如,在Raspberry PI中,您必须具有python-devpython3-dev ,如果您使用Raspberry PI尝试运行:

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

Then you will pass this step, if there come another errors make new posts. 然后,如果出现其他错误,请通过此步骤。

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/ 您可以在此处找到有关如何为Raspberry PI编译OpenCV的简单入门教程: https : //www.pyimagesearch.com/2016/04/18/install-guide-raspberry-pi-3-raspbian-jessie-opencv-3 /

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM