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

/usr/bin/g++ -shared -o python/caffe/_caffe.so python/caffe/_caffe.cpp \
        build/lib/libcaffe.a -pthread -fPIC -DNDEBUG -O2 -I/usr/local/include/python2.7 -          I/usr/local/lib/python2.7/dist-  packages/numpy/core/include -I/usr/local/include -Ibuild/src -I./src -I./include -I/usr/local/cuda/include -L/usr/local/lib -L/usr/local/lib -L/usr/lib -L/usr/local/cuda/lib64 - L/usr/local/cuda/lib -lcudart -lcublas -lcurand -lpthread -lglog -lprotobuf -lleveldb -lsnappy -lboost_system -lhdf5_hl -lhdf5 -lopencv_core -lopencv_highgui -lopencv_imgproc -lcblas -latlas -  lboost_python -lpython2.7
     In file included from /usr/include/boost/python/detail/prefix.hpp:13:0,
                  from /usr/include/boost/python/args.hpp:8,
                 from /usr/include/boost/python.hpp:11,
                 from python/caffe/_caffe.cpp:8:
          /usr/include/boost/python/detail/wrap_python.hpp:50:23: fatal error: pyconfig.h: No such file or         directory
       compilation terminated.
       make: *** [python/caffe/_caffe.so] Error 1

如果使用的是系统的python路径,解决方法如下:

make clean
export CPLUS_INCLUDE_PATH=/usr/include/python2.7
make all -j8

如果使用的是anaconda Python,路径如下:

export CPLUS_INCLUDE_PATH=/home/gpf/anaconda3/include/python3.6m

你可能感兴趣的:(计算机视觉)