Python interface of Caffe: Error in “import caffe”

大憨熊 提交于 2019-12-20 03:06:06

问题


I'm trying to run Caffe in it's Python interface. I've already run the command make pycaffe in the caffe directory and it worked fine. Now, when I run the command import caffe in the python environment in the terminal (Ubuntu 14.04), I'm getting the following error:

    >>> import caffe
    Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
     File "/home/pras/caffe/python/caffe/__init__.py", line 1, in <module>
      from .pycaffe import Net, SGDSolver
     File "/home/pras/caffe/python/caffe/pycaffe.py", line 11, in <module>
      import caffe.io
    ImportError: No module named io

I tried to search my computer for 'caffe.io' but couldn't find any file by that name. Any idea why this error is occurring and how to correct it?


回答1:


You need to add Python Caffe to PYTHONPATH. In your case:
export PYTHONPATH=$PYTHONPATH:/home/pras/caffe/python



来源:https://stackoverflow.com/questions/30745647/python-interface-of-caffe-error-in-import-caffe

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!