使用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

  >>>


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章