用anaconda2安装python caffe(pycaffe)

时间:2017-11-23 17:31:20

标签: python opencv ubuntu-14.04 anaconda pycaffe

我正在尝试运行此演示https://github.com/ZheC/Realtime_Multi-Person_Pose_Estimation

我正在运行ubuntu 14.04

我已经安装了Anaconda,在安装了许多依赖项后,另一个弹出。它还需要python caffe

所以我用这个命令安装了它: (我也试过Pip install caffe但是如果失败了)

Conda install caffe

但是当我尝试运行它时,我得到了:

$python
>>> import caffe
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/gtkratosman-lap/anaconda2/lib/python2.7/site-packages/caffe/__init__.py", line 1, in <module>
    from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver, NCCL, Timer
  File "/home/gtkratosman-lap/anaconda2/lib/python2.7/site-packages/caffe/pycaffe.py", line 13, in <module>
    from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, \
ImportError: libprotobuf.so.12: cannot open shared object file: No such file or directory

1 个答案:

答案 0 :(得分:1)

我已经能够在我自己的Anaconda环境中验证此行为,该环境在Python v2.7.14虚拟环境中运行conda v4.3.27,安装caffe v1.0.0rc5。

进一步研究这个问题后,它似乎与以下开放的Anaconda问题有关:caffe needs to pin protobuf requirement to version #6733

如问题中所述:

  

caffe中的caffe-gpudefaults包对protobuf有一个要求,没有任何版本依赖性。不幸的是,caffe包链接到libprotobuf.so.12,它是由protbuf版本3.2.0提供的

因此,我发现我能够在我的Anaconda虚拟环境中成功运行import caffe,首先手动安装protobuf v3.2.0,如下所示:conda install protobuf==3.2.0