2015-12-30 116 views
3

我在Mac上嘗試使用Python 3.5.1安裝OpenCV 3.0時遇到問題。無法完成OpenCV的安裝。 'numpy/ndarrayobject.h'文件未找到

錯誤在下面。

請問有人能幫我一下嗎?

這裏是我的終端命令腳本:

cmake -D CMAKE_BUILD_TYPE=RELEASE \ 
    -D CMAKE_INSTALL_PREFIX=/usr/local \ 
    -D PYTHON3_PACKAGES_PATH=~/.virtualenvs/cv3/lib/python3.5/site-packages \ 
    -D PYTHON3_LIBRARY=/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/libpython3.5m.dylib \ 
    -D PYTHON3_INCLUDE_DIR=/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include/python3.5m \ 
    -D INSTALL_C_EXAMPLES=ON \ 
    -D INSTALL_PYTHON_EXAMPLES=ON \ 
    -D BUILD_EXAMPLES=ON \ 
    -D BUILD_opencv_python3=ON \ 
    -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules .. 

這是我的錯誤:

/Users/##/opencv/modules/python/src2/cv2.cpp:10:10: fatal error: 
     'numpy/ndarrayobject.h' file not found 
#include <numpy/ndarrayobject.h> 
     ^
[ 73%] Linking CXX executable ../../bin/cpp-example-dft 
[ 73%] Built target example_dft 
Scanning dependencies of target example_distrans 
[ 73%] Building CXX object samples/cpp/CMakeFiles/example_distrans.dir/distrans.cpp.o 
[ 73%] Linking CXX executable ../../bin/cpp-example-detect_mser 
[ 73%] Built target example_detect_mser 
Scanning dependencies of target example_drawing 
[ 73%] Building CXX object samples/cpp/CMakeFiles/example_drawing.dir/drawing.cpp.o 
1 error generated. 
make[2]: *** [modules/python3/CMakeFiles/opencv_python3.dir/__/src2/cv2.cpp.o] Error 1 
make[1]: *** [modules/python3/CMakeFiles/opencv_python3.dir/all] Error 2 
make[1]: *** Waiting for unfinished jobs.... 
[ 73%] Linking CXX executable ../../bin/cpp-example-distrans 
[ 73%] Built target example_distrans 
[ 73%] Linking CXX executable ../../bin/cpp-example-drawing 
[ 73%] Built target example_drawing 
[ 73%] Linking CXX shared library ../../lib/cv2.so 
[ 73%] Built target opencv_python2 
make: *** [all] Error 2 

如果任何人有任何指導或要求更多的信息讓我知道。

謝謝。

回答

1

我可以conda在Mac上安裝OpenCV 3:

conda install -c https://conda.binstar.org/menpo opencv3 

的Python 3.5.1

的OpenCV:3.0.0

>>> import cv2 
>>> cv2.__version__ 
'3.0.0' 
+0

感謝麥克。將被挖入。 – Blighty

+0

它適合你嗎? –

+0

HI Mike。我有點轉身。我想我有一些舊的安裝正在運行。我卸載了所有項目。重新安裝,它的魅力。我甚至跑了一些早期的教程。感謝您的幫助! – Blighty