Python报错No module named 'cv2'

import cv2;
Python运行过程中报错No module named ‘cv2’

Traceback (most recent call last):
  File "/Users/congjam/PycharmProjects/Jam/Test.py", line 1, in <module>
    import cv2;
ModuleNotFoundError: No module named 'cv2'

原因:未安装opencv-python库
命令行模式安装:pip3 install opencv-python

JamSonsMacBook-Pro:~ jamson$ pip3 install opencv-python
Collecting opencv-python
  Downloading opencv_python-4.2.0.32-cp37-cp37m-macosx_10_9_x86_64.whl (47.9 MB)
     || 1.0 MB 22 kB/s eta 0:34:31

如果在PyCharm中,安装方式如下:
Python报错No module named 'cv2'_第1张图片
搜索opencv-python,点击【Install Package】
安装完成的时候,会提示"Package ‘opencv-python’ installed successfully"

你可能感兴趣的:(Python,python,cv,ide,pip)