简体   繁体   中英

Can't import CV2 in jupyter notebook

I have install cv2 library but I can't import it to my jupyter notebook.

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. 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:

!pip install opencv-python

... or if you want to use non-free modules:

!pip install opencv-contrib-python

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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