在 jupyter notebook 上导入 OpenCV [英] Import OpenCV on jupyter notebook

查看:51
本文介绍了在 jupyter notebook 上导入 OpenCV的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用 pip 在 Windows 10 上安装 OpenCV.我使用了这个命令-pip 安装 opencv-contrib-python

I tried installing OpenCV on Windows 10 using pip. I used this command- pip install opencv-contrib-python

之后,当我尝试在命令提示符下导入 cv2 时,它已成功导入-

After that when I tried importing cv2 on command prompt, it was successfully imported-

当我尝试在 jupyter notebook 上导入它时,出现了这个错误——

When I tried importing it on jupyter notebook, this error popped up-

这是我使用的python版本-

This is the python version I'm using-

这是 pip 列表,正如我所强调的,安装了 opencv-contrib-python 版本 3.4.3.18-

This is pip list and as I've highlighted, opencv-contrib-python version 3.4.3.18 is installed-

那为什么我不能在 jupyter notebook 上导入 OpenCV,比如 tensorflow 或 numpy 也在 pip 列表中,我可以通过命令提示符和 jupyter notebook 导入它们.

Then why can't I import OpenCV on jupyter notebook, like tensorflow or numpy are also in pip list and I'm able to import them both through command prompt and also on jupyter notebook.

请帮忙.非常感谢.

推荐答案

您已经在终端上运行的 Python 中安装了 openCV,而不是安装到运行 Jupyter Notebooks 的工作环境中.

You have installed openCV in Python running on your Terminal, not into the working environment which Jupyter Notebooks is running from.

在终端写入时:

py -m pip install opencv-python

当你使用pip list

你应该看到opencv-python 3.4.3.18

更多信息此处.

这篇关于在 jupyter notebook 上导入 OpenCV的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆