I am using caffe with python on ubuntu 16.04 now, after compiling and installing, I need to add the directory of caffe to the PYTHONPATH
variable in order that python knows how to find it when importing. But strange things happen here. I added the following line in ~/.bashrc
:
export PYTHONPATH="~/caffe/python/:$PYTHONPATH"
No need to mention, I encountered the problem that importing caffe failed, and I tried to find out why. Here is what I did in python:
>>>import sys
>>>sys.path
['','/home/roof/~/caffe/python',…………………]
Bash or python is adding a prefix /home/roof/
to the PYTHONPATH
variable I set, which is unexpected, but why? How can I get rid of it?