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

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.io

ImportError: 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/anaconda
PYTHON_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

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值