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

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

问题描述

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

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

当我尝试在jupyter笔记本上导入它时,此错误弹出-

这是我正在使用的python版本-

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

然后为什么我不能在jupyter笔记本上导入OpenCV,例如tensorflow或numpy也在点列表中,并且我既可以通过命令提示符也可以在jupyter笔记本上导入它们.

请帮助.非常感谢.

解决方案

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

在终端中写:

py -m pip install opencv-python

使用pip list

您应该看到opencv-python 3.4.3.18

更多信息此处.

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

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

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

This is the python version I'm using-

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

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.

Please help. Thanks a lot.

解决方案

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

Whilst in Terminal write:

py -m pip install opencv-python

When you use pip list

You should see opencv-python 3.4.3.18

More information here.

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

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