Install OpenCV under Anaconda (for MacOS and Windows)

Install OpenCV under Anaconda - for MacOS and Windows

Download Anaconda

First download and install the Anaconda official website addressPlease add image description
on the official website. After the download and installation is complete, enter the main interface:
Please add image description
enter the environment on the right: Environment
Please add image description
There is a Create in the lower left corner, create a new environment named " OpenCV ",
right-click and select " Open Terminal "
Please add image description
to open and enter the terminal:
Terminal enter

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

( Here we directly use the source of -i https://pypi.tuna.tsinghua.edu.cn/simple Tsinghua University )
to recommend some commonly used domestic source addresses

https://pypi.tuna.tsinghua.edu.cn/simple/ # 清华大学
https://pypi.douban.com/simple/ # 豆瓣
https://pypi.hustunique.com/ # 华中科技大学
https://mirrors.aliyun.com/pypi/simple/ # 阿里云
https://pypi.mirrors.ustc.edu.cn/simple/ # 中国科学技术大学

Please add image description
Generally speaking, the download will be completed and the installation will be completed normally. I still have an error in the download because of network problems . After repeated attempts
Please add image description
in this situation , an error will still be reported ... but the problem is not big! Take a look at the wrong question:

(OpenCV) bigboss@BigbossdeMacBook-Pro ~ % sudo pip install opencv-python -i https://pypi.tuna.tsinghua.edu.cn/simple


WARNING: The directory '/Users/bigboss/Library/Caches/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you should use sudo's -H flag.
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting opencv-python
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/8b/72/ce197a5650640f77342b3084be18783dc99debfcf20e2d98cde54050c97b/opencv_python-4.5.3.56-cp38-cp38-macosx_10_15_x86_64.whl (42.6 MB)
     |█████████████████████████████   | 38.6 MB 32 kB/s eta 0:02:03ERROR: Exception:

Error while downloading this file

 Downloading https://pypi.tuna.tsinghua.edu.cn/packages/8b/72/ce197a5650640f77342b3084be18783dc99debfcf20e2d98cde54050c97b/opencv_python-4.5.3.56-cp38-cp38-macosx_10_15_x86_64.whl (42.6 MB)

Copy this URL: opencv_python-4.5.3.56-cp38-cp38-macosx_10_15_x86_64.whl
Download it separately, put it on the desktop, and then cd to the desktop to execute the installation

cd desktop
ls
pip install opencv_python-4.5.3.56-cp38-cp38-macosx_10_15_x86_64.whl

Please add image description
It was installed very smoothly, and the numple library will be installed in the middle. There is no problem in
running it for a try , and the import is successful (if there is a small partner who needs to install opencv_python-4.5.3.56-cp38-cp38-macosx_10_15_x86_64.whl], I provide it separately in the CSDN download . Thank you, I wish you a smooth installation!
Please add image description


Guess you like

Origin blog.csdn.net/weixin_50679163/article/details/119328916
Recommended