2

Im trying compile OpenCV 3.1.0 on a EC2 instance with ubuntu 14.04.

But I log this error:

Scanning dependencies of target opencv_python2
[100%] Building CXX object    modules/python2/CMakeFiles/opencv_python2.dir/__/src2/cv2.cpp.o
/home/ubuntu/opencv/modules/python/src2/cv2.cpp:6:20: fatal error: Python.h: No such file or directory
#include <Python.h>
                ^
compilation terminated.
make[2]: *** [modules/python2/CMakeFiles/opencv_python2.dir/__/src2/cv2.cpp.o] Error 1
make[1]: *** [modules/python2/CMakeFiles/opencv_python2.dir/all] Error 2
make: *** [all] Error 2

I've compile OpenCV via SSH and nohup:

nohup sudo make > file.log &

I've generated the make file for OpenCV in this way:

cmake -D BUILD_opencv_gpu=OFF -D WITH_CUDA=OFF -D WITH_1394=OFF -D 
BUILD_opencv_gpu=OFF -D WITH_CUDA=OFF -D WITH_1394=OFF -D 
BUILD_opencv_video=OFF -D BUILD_opencv_calib3d=OFF -D 
BUILD_opencv_flann=OFF -D BUILD_opencv_photo=OFF -D 
BUILD_opencv_stitching=OFF -D BUILD_opencv_cudaarithm=OFF -D 
BUILD_opencv_cudabgsegm=OFF -D BUILD_opencv_cudacodec=OFF -D 
BUILD_opencv_cudafeatures2d=OFF -D BUILD_opencv_cudafilters=OFF -D 
BUILD_opencv_cudaimgproc=OFF -D BUILD_opencv_cudalegacy=OFF -D       
BUILD_opencv_cudaobjdetect=OFF -D BUILD_opencv_cudaoptflow=OFF -D
BUILD_opencv_cudastereo=OFF -D BUILD_opencv_cudawarping=OFF -D 
BUILD_opencv_cudev=OFF -D BUILD_opencv_superres=OFF -D 
BUILD_opencv_videostab=OFF -D BUILD_opencv_viz=OFF -D 
BUILD_opencv_aruco=OFF -D BUILD_opencv_bioinspired=OFF -D 
BUILD_opencv_dnn=OFF -D BUILD_opencv_dpm=OFF -D BUILD_opencv_face=OFF -D 
BUILD_opencv_fuzzy=OFF -D BUILD_opencv_saliency=OFF -D BUILD_opencv_sfm=OFF -D 
BUILD_opencv_stereo=OFF -D BUILD_opencv_structured_light=OFF -D 
BUILD_opencv_tracking=OFF -D BUILD_opencv_ximgproc=OFF -D 
BUILD_opencv_xobjdetect=OFF -D BUILD_opencv_xphoto=OFF -D 
BUILD_EXAMPLES=OFF -D WITH_OPENCL=OFF -D WITH_FFMPEG=OFF -D WITH_QT=OFF -D 
CMAKE_BUILD_TYPE=RELEASE -D INSTALL_C_EXAMPLES=OFF -D 
INSTALL_PYTHON_EXAMPLES=OFF  -D 
OPENCV_EXTRA_MODULES_PATH=/home/ubuntu/opencv_contrib/modules/ -D 
PYTHON2_INCLUDE_DIR=/usr/include/python2.7 -D 
PYTHON2_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython2.7.so -D 
PYTHON2_NUMPY_INCLUDE_DIRS=/usr/lib/python2.7/dist-packages/numpy/core/include/ ../

I have already installed python-dev. Any Suggestions?

1 Answer 1

2
sudo apt-get install python-dev

or

sudo apt-get install python3-dev

install and try again compile

fatal error: Python.h: No such file or directory

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.