无法将caffe导入python,找不到libjpeg.so.62

时间:2015-06-08 13:25:24

标签: python linux anaconda caffe

我无法将caffe导入(anaconda-)python。 我正在对非图像HDF5数据进行notebook example"逻辑回归"。当我执行该行

import caffe

我收到以下错误:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-17-3524921938b5> in <module>()
      8 sys.path.insert(0, caffe_root + 'python')
      9 
---> 10 import caffe
     11 

/home/myName/libs/caffe/caffe-master-anaconda-python/python/caffe/__init__.py in <module>()
----> 1 from .pycaffe import Net, SGDSolver
      2 from ._caffe import set_mode_cpu, set_mode_gpu, set_device, Layer, get_solver
      3 from .proto.caffe_pb2 import TRAIN, TEST
      4 from .classifier import Classifier
      5 from .detector import Detector

/home/myName/libs/caffe/caffe-master-anaconda-python/python/caffe/pycaffe.py in <module>()
     11 import numpy as np
     12 
---> 13 from ._caffe import Net, SGDSolver
     14 import caffe.io
     15 

ImportError: libjpeg.so.62: cannot open shared object file: No such file or directory

libjpeg.so.62完全安装在/usr/lib/i386-linux-gnu/libjpeg.so.62下。我不知道这里出了什么问题或如何告诉anacondapython在哪里寻找libjpeg.so.62

我已经尝试sudo apt-get install libjpeg62:i386,但apt-get说"libjpeg62:i386 is already the newest version. libjpeg62:i386 set to manually installed."

我在修改&#34; Makefile.config&#34;时编译了caffe。这样它就指向了ananconda python路径。我还导出了我的anaconda目录的PYTHONPATH和PATH:

export PATH="/home/myName/libs/anaconda/bin:$PATH"
export PYTHONPATH="/home/myName/libs/caffe/caffe-master-anaconda-python/python:$PYTHONPATH"

1 个答案:

答案 0 :(得分:0)

好的,我终于找到了解决方案:

我不得不sudo apt-get install libjpeg62

之后尝试import caffe时发生了新错误,即

ImportError: /home/myName/libs/anaconda/bin/../lib/libm.so.6: version `GLIBC_2.15' not found (required by /usr/lib/x86_64-linux-gnu/libx264.so.142)

这可以通过删除一些有缺陷的anaconda库来解决,从而诉诸于系统库,引用shelhamer: &#34;一些版本的Anaconda似乎带有一个糟糕的libm。 rm ~/anaconda/lib/libm.*通过恢复到系统libm来处理这个问题。&#34;

请参阅github bvlc