Tag Archives: pycaffe

Mac OS error in make pycaffe times failure error:’python.h’file not found resolved

After installing caffe, report the following error when executing Make Pycaffe in caffe/build:

 linxierdeAir:caffe linxier$ cd build
linxierdeAir:build linxier$ make pycaffe
[  1%] Built target caffeproto
[ 98%] Built target caffe
[ 98%] Building CXX object python/CMakeFiles/pycaffe.dir/caffe/_caffe.cpp.o
/Users/linxier/caffe/python/caffe/_caffe.cpp:1:10: fatal error: 'Python.h' file
      not found
#include <Python.h>  // NOLINT(build/include_alpha)
         ^~~~~~~~~~
1 error generated.
make[3]: *** [python/CMakeFiles/pycaffe.dir/caffe/_caffe.cpp.o] Error 1
make[2]: *** [python/CMakeFiles/pycaffe.dir/all] Error 2
make[1]: *** [python/CMakeFiles/pycaffe.dir/rule] Error 2
make: *** [pycaffe] Error 2

Solutions:

Export CPLUS_INCLUDE_PATH =/System/Library/Frameworks/Python framework Versions/2.7/include/python2.7

Reference links: https://stackoverflow.com/questions/35778495/fatal-error-python-h-file-not-found-while-installing-opencv
the path name to your computer contains Python. H folder path, after successful compilation.