在安装完python接口后,在终端输入python,import caffe会失败,提示“No module named caffe”
解决方案:
vi ~/.bashrc
添加: export CAFFE_ROOT=/home/your_path_to_caffe/caffe eg:/home/dell/caffe
export PYTHONPATH=/home/your_path_to_caffe/caffe/python:$PYTHONPATH
source ~/.bashrc
终端输入python后import sys
添加: sys.path.insert(0,'/home/your_path_to_caffe/caffe')
sys.path.insert(0,'/home/your_path_to_caffe/caffe/python')
如果import caffe 还是报错:“No module named caffe” ,请先注销下用户,在登陆试试
再次尝试:import caffe
倘若报错:ImportError: No module named skimage.io
安装: sudo apt-get install python-matplotlib python-numpy python-pil python-scipy
sudo apt-get install build-essential cython
sudo apt-get install python-skimage
再次尝试: import caffe
倘若报错:ImportError: No module named google.protobuf.internal
安装: sudo pip install protobuf
亲测3台电脑,都行。