1

I have CentOS6.5 installed. I have python 2.7.9 installed. I built it from source. The numpy 1.9.1 installed using pip.

I am trying to install opencv 2.4.10 from source. I ran following commands from opencv src directory using root previleges.

mkdir build

cd build

cmake ../ -DCMAKE_BUILD_TYPE=RELEASE \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DBUILD_EXAMPLES=ON \
-DBUILD_NEW_PYTHON_SUPPORT=ON \
-DINSTALL_PYTHON_EXAMPLES=ON \
-DPYTHON_EXECUTABLE=/usr/local/bin/python2.7 \
-DPYTHON_INCLUDE_DIR=/usr/local/include/python2.7/ \
-DPYTHON_LIBRARY=/usr/local/lib/libpython2.7.so.1.0 \
-DPYTHON_NUMPY_INCLUDE_DIR=/usr/local/lib/python2.7/site-packages/numpy/core/include/numpy \
-DPYTHON_PACKAGES_PATH=/usr/local/lib/python2.7/site-packages/ \
-DBUILD_PYTHON_SUPPORT=ON


make

I am getting following error.

[ 76%] Generating generated0.i
Generated 377 functions
Scanning dependencies of target opencv_python
[ 76%] Building CXX object modules/python/CMakeFiles/opencv_python.dir/src2/cv2.cpp.o
/usr/src/opencv-2.4.10/modules/python/src2/cv2.cpp:15:33: error: numpy/ndarrayobject.h: No such file or directory
/usr/src/opencv-2.4.10/modules/python/src2/cv2.cpp: In member function ‘virtual void NumpyAllocator::allocate(int, const int*, int, int*&, uchar*&, uchar*&, size_t*)’:
/usr/src/opencv-2.4.10/modules/python/src2/cv2.cpp:184: error: ‘NPY_UBYTE’ was not declared in this scope


/usr/src/opencv-2.4.10/modules/python/src2/cv2.cv.hpp:423: warning: ‘cvmat_methods’ defined but not used [-Wunused-variable]
make[2]: *** [modules/python/CMakeFiles/opencv_python.dir/src2/cv2.cpp.o] Error 1
make[1]: *** [modules/python/CMakeFiles/opencv_python.dir/all] Error 2

Can you please help?

I build python with "--enable-shared" flag I commented out line 50 string(MD5 hash "${lines}") /usr/src/opencv- 2.4.10/cmake/cl2cpp.cmake

1 Answer 1

1
-DPYTHON_NUMPY_INCLUDE_DIR=/usr/local/lib/python2.7/site-packages/numpy/core/include

remove tailing /numpy and it should be fine.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.