简体   繁体   中英

No module called cv2

I am using Ubuntu 18.04 and I follow the official install instruction of OpenCV. When I tried to import cv2 on python3.8, it shows

No module named cv2 

but for python2.7, it works for me and I use the command cmake../ to access and it only shows python2.7 has built into it. Does anyone meet the same problem? Please see the screenshot for more details.

Have you tried installed python package opencv-python using pip?

Try this

pip3 install opencv-python

Open the containing folder of your python.exe of Python 2.7, and there you will find the site-packages folder. In there, copy the cv2 folder, and paste it into the Python 3.8 site-packages folder.

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