Anaconda installs opencv (cv2), used in jupyter notebook

1. Problem description

When the cv2 package needs to be imported , there will be many errors. We can solve the problem by importing opencv .

When searching for information, I learned a lot of methods. Here are two methods I have tried.

Two, the solution

1. Download in the anaconda interface

Find environments and click, the interface is as follows. Install the steps in the figure below, select not installed, then search for opencv in the search bar on the right, check it and click Apply.

This method is very intuitive, but the problem is that the download speed is very unstable, and sometimes it cannot respond at all. If you want to speed up the download speed, you can change the source, but the mirror source sometimes stops serving and is not stable. Share the article: anaconda conda change source_strange_jiong's blog-CSDN blog_conda Tsinghua source

2. Install with anaconda prompt

(1) Click anaconda in the start menu to find the prompt inside, click

 

(2) Look at the location displayed on the interface, first switch to the location where anaconda is installed, (you can determine the location of the Script folder through the pop-up running interface when opening anaconda, as follows, get the location of the Script folder in my computer)

 

 Enter cd xxxxxx (the name of the folder where anaconda is located); then enter cd Scripts (to install opencv in this folder) ( you can operate according to the location obtained earlier, that is, C:\Users\yyr17\anaconda3\Scripts )

(3) Copy the following commands one by one (download is faster in the Tsinghua mirror library)

pip install opencv-python -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install opencv-contrib-python -i https://pypi.tuna.tsinghua.edu.cn/simple

You can enter conda list to see if the download is successful

Guess you like

Origin blog.csdn.net/weixin_51472673/article/details/125173487