caffe安装问题——numpy/arrayobject.h: No such file or directory

BLVC/CAFFE安装,编译linux自带的python2.7(或者python3.5)下的pycaffe:

1.编译运行pycaffe:

sudo make pycaffe -j8

2.报错:

ljm@ljm:~/caffe$ sudo make pytest –j8
CXX/LD -o python/caffe/_caffe.so python/caffe/_caffe.cpp
python/caffe/_caffe.cpp:10:31: fatal error: numpy/arrayobject.h: No such file or directory
 #include 
                               ^
compilation terminated.
Makefile:517: recipe for target 'python/caffe/_caffe.so' failed
make: *** [python/caffe/_caffe.so] Error 1

3.解决办法:在makefile.config中添加一行:  /usr/local/lib/python2.7/dist-packages/numpy/core/include

PYTHON_INCLUDE := /usr/include/python2.7 \
		/usr/lib/python2.7/dist-packages/numpy/core/include \
                /usr/local/lib/python2.7/dist-packages/numpy/core/include 

4.编译成功:

再次:编译成功

sudo make pycaffe -j8

 5.将caffe库添加到环境变量:

# 1.编辑~/.bashrc文件
sudo gedit ~/.bashrc

# 2.在文件内容最后一行添加如下内容,其中ljm是你自己的usename
export PYTHONPATH=/home/ljm/caffe/python:$PYTHONPATH

# 3.右键保存,×掉退出

# 4.激活环境变量
source ~/.bashrc

 测试安装结果:

ljm@ljm:~/caffe$ python
Python 2.7.12 (default, Nov 12 2018, 14:36:49) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import caffe
>>> exit(0)

 

你可能感兴趣的:(caffe安装问题——numpy/arrayobject.h: No such file or directory)