简体   繁体   中英

Python interface of Caffe: Error in “import caffe”

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM