cv2 library is in the opencv library, so you need to download opencv-python
1. Open the windows command line:
win R
cmd
2. Update pip version (not necessary):
python -m pip install --upgrade pip
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
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.
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!