Home  >  Article  >  Backend Development  >  python3 fails to install caffe under anaconda

python3 fails to install caffe under anaconda

巴扎黑
巴扎黑Original
2017-06-23 15:49:181514browse

Python and Python3 are completely two languages

 0x00 import caffe FAILED
 
The environment is Ubuntu 16 cuda 8.0 NVIDIA 361.77 Anaconda2. Yesterday, Caffe was inexplicably unavailable:

>>> import caffe
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/duchengyao/project/caffe/python/caffe/__init__.py", line 1, in <module>
    from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver
  File "/home/duchengyao/project/caffe/python/caffe/pycaffe.py", line 13, in <module>
    from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, \
ImportError: /home/duchengyao/project/caffe/python/caffe/../../build/lib/libcaffe.so.1.0.0-rc3: undefined symbol: _ZN2cv8imencodeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNS_11_InputArrayERSt6vectorIhSaIhEERKSB_IiSaIiEE

All kinds of attempts were ineffective. After reinstalling Anaconda, the error disappeared and import caffe was successful.

 0x01 import FAILED again after “$conda install opencv”
 
After installing Opencv with conda install opencv, the same error message appeared again, and the error disappeared after uninstalling .
 
 The Opencv version installed by Conda is 2.4.10, and the version installed by system apt is 2.4.9.1. I tried to install version 2.4.9 from conda, but there were a lot of conflicts to deal with.
 
Finally, I had no choice but to switch to Anaconda3. After the environment was set up, it was really awkward to run the program because various libraries were incompatible. Finally I understand why the veterans joked that Python and Python3 are completely two different languages
 
 0x02 Solution
 
The temporary solution is to abandon anaconda and install everything with apt The software package uses the system default Opencv and runs successfully.

Attachment: Chinese version of Python3 tutorial pdf

The above is the detailed content of python3 fails to install caffe under anaconda. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn