The most effective way to install OpenCV in Anaconda

Problem background:

If you have tried many methods of installing opencv in Anaconda and it doesn't work , then this method in this article can fundamentally solve this problem.

Installation preparation:

The python in Anaconda3 is recommended to be version 3.6 , and the installed opencv is preferably the corresponding version 3.4.1.15 . The installed opencv files are two, and the latter is the opencv expansion library (opencv_python-3.4.1.15-cp36-cp36m-win_amd64. whl, opencv_contrib_python-3.4.1.15-cp36-cp36m-win_amd64.whl). If your system is 32-bit, please select the corresponding version of the file to install.
For the corresponding relationship between Anaconda3 and python versions, please refer to this blogger’s article: the download address of opencv_python-3.4.1.15 of each version and the download address
of version 64 of opencv_contrib_python-3.4.1.15, and the download address of other versions of opencv_python

Installation process:

first step

Create a new folder and save the downloaded opencv file in it. (Example: D:\001Major\CVMV\OpenCV)
opencv save address

second step

Click anaconda3 in the start menu, find the prompt (as shown below) and open it.
insert image description here
The location displayed at this time is the C drive (an environment created by the original anaconda itself)
insert image description here
input

D:

Enter the D disk area (my anaconda and opencv are installed on the D disk, if you install it on other disks, you can change it yourself)
insert image description here

third step

Then enter cd plus your anaconda installation path, for example

cd 001Major\CVMV\Anaconda3\jupyter

insert image description here
At this point enter the installation location of anaconda
insert image description here

the fourth step

Enter pip install "the save path of opencv downloaded by yourself in the first step and the file name of opencv (including the suffix name)" (remember the double quotes) for example

pip install "D:\001Major\CVMV\OpenCV\opencv_python-3.4.1.15-cp36-cp36m-win_amd64.whl"

insert image description here
After running, it will show that the installation is successful.
insert image description here
In the same way, to install opencv_contrib_python, you only need to change the file name.
insert image description here

Result test:

Click on anaconda3, find the prompt (as shown below) and open it, enter

python

insert image description here
enter

import cv2

If it can run, it means that the installation of opencv is successful.
insert image description here
Look at the version and enter

cv2.__version__

Note: There are two short underscores before and after
insert image description here
OK, the installation is over!

Guess you like

Origin blog.csdn.net/weixin_43555555/article/details/128707640
Recommended