如何在 Jupyter notebook 上导入 openCV?

How to import openCV on Jupyter notebook?

问题:当我在 Jupyter notebook 上命令 import cv2 时,出现 ModuleNotFoundError:"No module named 'cv2'".

我尝试了什么:在 Anaconda 上,我按照 this question. I also tried the command pip install opencv-python as explained in step 2 in this 手册中的建议编写了 py -m pip install opencv-pythonconda install opencv。但是每次我都遇到同样的错误(在 Jupyter notebook 上)。

求助,谢谢

尝试pip3 install opencv-python

也尝试 pip3 install opencv-python== 查看所有可用版本

在当前的Jupyter内核中安装一个pip包

我 运行 遇到过类似的问题,这篇文章帮助我解决了问题。您可以尝试从 Jupyter Notbeook 内核中安装它。

import sys
!{sys.executable} -m pip install opencv-python

Article 我参考