我尝试使用ubuntu 14.04在EC2实例上编译OpenCV 3.1.0。
但我记录了这个错误:
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
我通过SSH和nohup编译OpenCV:
nohup sudo make > file.log &
我以这种方式为OpenCV生成了make文件:
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/ ../
我已经安装了 python-dev 。有什么建议吗?
答案 0 :(得分:1)
sudo apt-get install python-dev
或
sudo apt-get install python3-dev
安装并再次尝试编译