python - 使用 anaconda2 安装 python caffe (pycaffe)

标签 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

最佳答案

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

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

如问题中所述:

The caffe and caffe-gpu package in defaults has a requirement on protobuf without any version dependencies. Unfortunately, the caffe packages links to libprotobuf.so.12 which is provided by the protbuf version 3.2.0

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

关于python - 使用 anaconda2 安装 python caffe (pycaffe),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47460860/

相关文章:

python - 如何在 Django 查询中混合 AND 和 OR 运算符?

python-2.7 - 像 Gimp 中那样的 OpenCV 亮度和对比度

mongodb - Docker:更改存储 docker 卷的文件夹

java - 无法在 ubuntu 上为 eclipse 设置 lwjgl

ubuntu-14.04 - 增加 Grace/xmgrace 编辑器窗口中的字体大小

Python - 在贝塞尔曲线上均匀分布对象

python - 平铺 map 和 Sprite : am I doing it the right way?

python - 使用 python 2.4 计算 CSV 文件中的列数

c++ - OpenCV VideoWriter 创建空文件

c++ - 使用 Visual Studio 2008 构建 OpenCV 应用程序并从另一台计算机运行它