【Caffe安裝】ImportError: No module named caffe 的解決方案

1, 在成功編譯caffe的源碼之後,可以在python環境中使用caffe。在Ubuntu環境下,打開python解釋程序,輸入import caffe時,可能會出現 ImportError: No module named caffe

>>>import caffe
   Traceback (most recent call last): 
   File "<stdin>", line 1, in <module> 
   ImportError: No module named caffe

這種情況一般是沒有把caffe中的和python相關的內容的路徑添加到python的編譯路徑中。可以在shell 中輸入以下命令:

sudo gedit /etc/profile

然後在最後添加路徑:

export PYTHONPATH=/home/justin/caffe/python:$PYTHONPATH

之後再python下import caffe就會正常運行了。

2, 如果有其他問題,可以參考http://blog.csdn.net/liyaohhh/article/details/50876777

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章