成都网站建设设计

将想法与焦点和您一起共享

使用anaconda安装caffe

通过 conda 安装 caffe-gpu 和 caffe

让客户满意是我们工作的目标,不断超越客户的期望值来自于我们对这个行业的热爱。我们立志把好的技术通过有效、简单的方式提供给客户,将通过不懈努力成为客户在信息化领域值得信任、有价值的长期合作伙伴,公司提供的服务项目有:主机域名、网络空间、营销软件、网站建设、阿里地区网站维护、网站推广。

一开始直接使用conda安装caffe结果报错。通过不断搜索,最终找到了解决方法:

conda create -n caffe_gpu -c defaults python=3.6 caffe-gpu

conda create -n caffe -c defaults python=3.6 caffe

解决方案的原链接在此。安装caffe_gpu时,对应版本的cudatoolkit 、cudnn 也会被安装。

外网大神的原话是:

I will repeat my comment from earlier in this issue, please do not use the anaconda channel when installing caffe, it does not preserve the priority between the main and free sub-channels. Installing caffe or caffe-gpu from the defaults channel is the only method supported by Anaconda and currently works. For example the following two command will create working environments:

conda create -n caffe_gpu -c defaults python=3.6 caffe-gpu

conda create -n caffe -c defaults python=3.6 caffe

意思就是要想通过conda安装caffe,所有库必须全部使用defaults这个频道,而不能使用或者上混合使用Anaconda 、 conda-forge这些频道的库。

我遇到的问题:

由于一开始 create python 虚拟环境的时候使用conda-forge, 安装caffe时混合了defaults(第一次)、Anaconda(第二次)的库,结果出现了下面的错误:

>>> import caffe

Failed to include caffe_pb2, things might go wrong!

Traceback (most recent call last):

File "", line 1, in

File "/home/allen/anaconda3/envs/caffegpu/lib/python3.5/site-packages/caffe/__init__.py", line 4, in

from .proto.caffe_pb2 import TRAIN, TEST无锡人流多少钱 http://www.bhnnk120.com/

File "/home/allen/anaconda3/envs/caffegpu/lib/python3.5/site-packages/caffe/proto/caffe_pb2.py", line 7, in

from google.protobuf import descriptor as _descriptor

File "/home/allen/anaconda3/envs/caffegpu/lib/python3.5/site-packages/google/protobuf/descriptor.py", line 47, in

from google.protobuf.pyext import _message

ImportError: /home/allen/anaconda3/envs/caffegpu/lib/python3.5/site-packages/google/protobuf/pyext/_message.cpython-35m-x86_64-linux-gnu.so: undefined symbol: _ZNK6google8protobuf10TextFormat17FieldValuePrinter9PrintBoolEb

>>>

>>> import caffe

Traceback (most recent call last):

File "", line 1, in

File "/home/allen/anaconda3/envs/caffe/lib/python3.5/site-packages/caffe/__init__.py", line 1, in

from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver, NCCL, Timer

File "/home/allen/anaconda3/envs/caffe/lib/python3.5/site-packages/caffe/pycaffe.py", line 13, in

from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, \

ImportError: /home/allen/anaconda3/envs/caffe/lib/python3.5/site-packages/caffe/../../../libcaffe.so.1.0.0: undefined symbol: _ZNK7leveldb6Status8ToStringB5cxx11Ev

>>>


分享文章:使用anaconda安装caffe
新闻来源:http://chengdu.cdxwcx.cn/article/gihogo.html