Home >Backend Development >Python Tutorial >Sharing the solution to the failure of python3 to install caffe under anaconda

Sharing the solution to the failure of python3 to install caffe under anaconda

黄舟
黄舟Original
2017-06-18 11:30:452240browse

The following editor will bring you an article to solve the problem of python3installationcaffe failure under anaconda. The editor thinks it is quite good, so I will share it with you now and give it as a reference for everyone. Let’s follow the editor and take a look.

Python and Python3 are completely two languages

1. 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: _ZN2cv8imencodeERKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNS_11_InputArrayERSt6vectorIhSaIhEERKSB_IiSaIiEE

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

2. import FAILED again after “$conda install opencv”

After installing Opencv with conda install opencv, the same error occurred again The error message disappears 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 awkward to run the program because various libraries were incompatible. Finally I understand why the veterans joke that Python and Python3 are completely two different languages

#3. Solution

The temporary solution is Give up anaconda, use apt to install all software packages, use the system default Opencv, and run successfully.

The above is the detailed content of Sharing the solution to the failure of python3 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