本文介绍了导入Caffe错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在ubuntu机器上成功编译了caffe,但是无法在python中导入。
i compiled caffe successfully in my ubuntu machine but cannot import in python.
安装了Caffe / home / pbu / Desktop / caffe
Caffe is installed /home/pbu/Desktop/caffe
我尝试将/ home / pbu / caffe / python路径添加到sys.path.append中,但仍无法正常工作
i tried adding the /home/pbu/caffe/python path to sys.path.append, still not working
我正在尝试导入caffe
i am trying to import caffe
root@pbu-OptiPlex-740-Enhanced:/home/pbu/Desktop# python ./caffe/output.py
Traceback (most recent call last):
File "./caffe/output.py", line 13, in <module>
import caffe
File "/home/pbu/Desktop/caffe/python/caffe/__init__.py", line 1, in <module>
from .pycaffe import Net, SGDSolver
File "/home/pbu/Desktop/caffe/python/caffe/pycaffe.py", line 10, in <module>
from ._caffe import Net, SGDSolver
ImportError: No module named _caffe
推荐答案
当您没有分别为python文件运行 make
时,就会发生这种情况。
This happens when you have not run make
for the python files separately.
在Caffe目录中运行 make
后立即运行 make pycaffe
。
Run make pycaffe
soon after running make
in the Caffe directory.
您可能必须在 Makefile.config
这篇关于导入Caffe错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!