【发布时间】:2016-04-21 22:09:02
【问题描述】:
为了构建 OpenCV,我在终端的 ~/opencv/build 目录中运行了它:
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/path/to/opencv-3.0.0/build -D PYTHON2_LIBRARY=/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/bin
-D PYTHON2_INCLUDE_DIR=/usr/local/Frameworks/Python.framework/Headers -D PYTHON2_PACKAGES_PATH=/usr/local/lib/python2.7/site-packages -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D OPENCV_EXTRA_MODULES_PATH=/path/to/opencv_contrib-3.0.0/modules ../
但无论发生什么,我都会在 Traceback 中看到这个错误:(Could NOT find PythonInterp:)
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named numpy.distutils
-- Could NOT find PythonInterp: Found unsuitable version "2.7.11",
but required is at least "3.4" (found /usr/local/bin/python)
-- Could NOT find PythonInterp: Found unsuitable version "2.7.11",
but required is at least "3.2" (found /usr/local/bin/python)
再往下看,就会出现
--
-- Python 2:
-- Interpreter: /usr/local/bin/python2.7 (ver 2.7.11)
--
-- Python 3:
-- Interpreter: NO
--
-- Python (for build): /usr/local/bin/python2.7
--
-- Java:
-- ant: NO
-- JNI:
正确的输出应该是这样的: correct Python Interp output
我已经尝试了所有方法,但这种情况不断出现! 本质上,我无法正确构建 OpenCV,因此无法正确安装。
【问题讨论】:
-
感谢您的编辑,b.enoit.be!
标签: python python-2.7 opencv numpy cmake