通过 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
>>>
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。