Compilation with Make in Caffe.ImportError: No module named _caffe

来源:互联网 发布:网络命令大全 编辑:程序博客网 时间:2024/06/08 12:32

2016.12.15
SIAT

Today, when I tried to write code in the Jupyter through the brown, I got a error like below:

ImportError                               Traceback (most recent call last)<ipython-input-9-1cca3aa1f8c5> in <module>()----> 1 import caffe/home/emma/software/caffe/python/caffe/__init__.py in <module>()----> 1 from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver      2 from ._caffe import set_mode_cpu, set_mode_gpu, set_device, Layer, get_solver, layer_type_list, set_random_seed      3 from ._caffe import __version__      4 from .proto.caffe_pb2 import TRAIN, TEST      5 from .classifier import Classifier/home/emma/software/caffe/python/caffe/pycaffe.py in <module>()     11 import numpy as np     12 ---> 13 from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, \     14         RMSPropSolver, AdaDeltaSolver, AdamSolver     15 import caffe.ioImportError: No module named _caffe

Then I google that problem.
It seems like that I did not compile successfully. And I checked the caffe official websiteCaffe installation to find out whether I forgot something.
Actually, I did. I did not run make pycaffe and make distribute. And I tried to run these two code. But it failed again and again. Error is that the terminal can not find Python.h ‘s position. I think it is weird. Because I can find this file through manual search. And I also checked my environment variables, it seems good. And I google this problem again and again. Then I saw a sentence ‘All the problems come from the wrong makefile.configure file’. Then I began to check my makefile again. At first, I did not find out any error. But at last I noticed that I did lost a word between my python place.

To sum up, The core is these sentences.

ANACONDA_HOME := $(HOME)/software/anacondaPYTHON_INCLUDE := $(ANACONDA_HOME)/include \        $(ANACONDA_HOME)/include/python2.7 \        $(ANACONDA_HOME)/lib/python2.7/site-packages/numpy/core/include \

You must make sure they are right.

Then you can run make pycaffe and make distribution.
Good luck.


Emma
2016.12.15
SIAT
wsj8020@gmail.com

0 0
原创粉丝点击