th@th-Satellite-L40-A:~/caffe$ python
>>> import caffe
若不报错则表示 caffe 的 python 接口已正确编译
以下是我导入 caffe 时出现的错误:
1.No module named caffe
>>>import caffe
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named caffe
基本思路是把caffe中的python导入到解释器中
把环境变量路径放到 ~/.bashrc文件中,打开文件
sudo vim ~/.bashrc
不会用vim可以用
sudo gedit ~/.bashrc
在文件下方写入
export PATHONPATH=/home/xxx/caffe/python/caffe:$PATHONPATH
XXX为usrname
多个路径的话以冒号分隔,保存后输入:
source ~/.bashrc
th@th-Satellite-L40-A:~/caffe$ python
>>>import caffe
>>>
搞定