[英]Python interface of Caffe: Error in “import caffe”
I'm trying to run Caffe in it's Python interface. 我正在尝试在Python接口中运行Caffe。 I've already run the command
make pycaffe
in the caffe directory and it worked fine. 我已经在caffe目录中运行了命令
make pycaffe
并且它运行良好。 Now, when I run the command import caffe
in the python environment in the terminal (Ubuntu 14.04), I'm getting the following error: 现在,当我在终端(Ubuntu 14.04)的python环境中运行命令
import caffe
,出现以下错误:
>>> 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. 我试图在计算机上搜索“ caffe.io”,但找不到该名称的任何文件。 Any idea why this error is occurring and how to correct it?
知道为什么会发生此错误以及如何纠正它吗?
You need to add Python Caffe to PYTHONPATH. 您需要将Python Caffe添加到PYTHONPATH。 In your case:
在您的情况下:
export PYTHONPATH=$PYTHONPATH:/home/pras/caffe/python 导出PYTHONPATH = $ PYTHONPATH:/ home / pras / caffe / python
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.