2016-04-21 85 views
0

打造OpenCV的,我在我的〜/ OpenCV的/ build目錄的終端運行此:大廈OpenCV的cmake的錯誤:無法找到PythonInterp

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 ../ 

但無論發生什麼,我在看到這個錯誤回溯:(找不到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,因此無法正確安裝。

+0

感謝您的編輯,b.enoit.be! –

回答

3

你有關無法找到numpy的錯誤會談,所以安裝numpy的:

pip install numpy 

此外,改變你的include目錄,以確保你實際上包括它。對於PYTHON2_INCLUDE_DIR

-D PYTHON2_INCLUDE_DIR=/usr/local/Frameworks/Python.framework/Headers 

然後,運行make clean和刪除您/build目錄,並再次運行cmake,然後make

+0

不幸的是,這也不起作用... –

+0

你有'numpy'安裝? – mprat

+0

我不這麼認爲......我該怎麼做? –

0

您可以手動指定每個版本的Python的路徑。 enter image description here