简体   繁体   English

无法在 jupyter notebook 中导入 CV2

[英]Can't import CV2 in jupyter notebook

I have install cv2 library but I can't import it to my jupyter notebook.我已经安装了 cv2 库,但我无法将它导入到我的 jupyter 笔记本中。

this is how I installed it:这是我安装它的方式:

import sys
!conda install --yes --prefix {sys.prefix} opencv
import cv2
>>>
ImportError: libGL.so.1: cannot open shared object file: No such file or directory

I have tried to install libGL but still got that error.我尝试安装 libGL,但仍然出现该错误。 Any idea how can I solve this?知道我该如何解决这个问题吗?

Instead of using conda, try using the pip formula, which is specifically built for the Python ecosystem, place this in a separate cell and run it:尝试使用专为 Python 生态系统构建的pip公式,而不是使用 conda,将其放在单独的单元格中并运行它:

!pip install opencv-python

... or if you want to use non-free modules: ...或者如果您想使用非自由模块:

!pip install opencv-contrib-python

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM