caffe加入python接口,解决import caffe错误

http://www.roselady.vip/a/cangjingge/boke/2018/0312/694.html

1、安装依赖库

1 sudo apt-get install python-numpy python-scipy python-matplotlib python-sklearn python-skimage python-h5py \
2  python-protobuf python-leveldb python-networkx python-nose python-pandas python-gflags Cython ipython

2、在caffe根目录下运行make pycaffe,如果出现“make: Nothing to be done for `pycaffe'.”先make clean一下下


3、配置环境变量,临时 export PYTHONPATH=/path/caffe/python:$PYTHONPATH

   注意:  /path/caffe/python 这是你的caffe的路径下面的python

4、进入python ,import caffe测试不会出错OK

5、将环境变量加到profile文件,以后不用每次都设置了。

1 vim /etc/profile
2  
3 "font-family: Arial, Verdana, sans-serif;">export  PYTHONPATH=/path/caffe/python:$PYTHONPATH
4  
5 添加完成后记得要
6  
7 source profile

你可能感兴趣的:(caffe)