How to use Python's cv2 library and download the OpenCV library?

PHPz
Release: 2023-04-24 21:55:14
forward
1997 people have browsed it

cv2 library is in the opencv library, so you need to download opencv-python
1. Open the windows command line:

win R
cmd

How to use Pythons cv2 library and download the OpenCV library?

2. Update pip version (not necessary):

python -m pip install --upgrade pip

How to use Pythons cv2 library and download the OpenCV library?

3. Use pip to download opencv:
It is best to download the numpy library before downloading the opencv library.
The mirror source of the University of Science and Technology of China is used here: https://pypi.mirrors.ustc.edu.cn/simple/

pip install numpy -i https://pypi.mirrors.ustc. edu.cn/simple/
pip install opencv-python -i https://pypi.mirrors.ustc.edu.cn/simple/

4. View the downloaded libraries and versions :

pip list

How to use Pythons cv2 library and download the OpenCV library?

5. Code application cv2:
Create a new .py file in Pycharm and write the code :

import cv2

The code does not report an error, basically you can use the opencv library.

How to use Pythons cv2 library and download the OpenCV library?

The above is the detailed content of How to use Python's cv2 library and download the OpenCV library?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!