caffe加入python接口,解决import caffe错误
1、安装依赖库
3、配置环境变量,临时export PYTHONPATH=/path/caffe/python:$PYTHONPATH
sudo apt-get install python-numpy python-scipy python-matplotlib python-sklearn python-skimage python-h5py \ 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文件,以后不用每次都设置了。
vim /etc/profile
export PYTHONPATH=/path/caffe/python:$PYTHONPATH
添加完成后记得要
source profile
|