Ask Your Question
-1

How to change OpenCV python 3

asked 2020-06-26 04:25:12 -0600

Sai Nyi gravatar image

updated 2020-06-28 05:10:41 -0600

Hello, I just install Open CV 4.1 on my raspberry pi and it success. But when I try to import cv2 with my python 3, it does not work.

But, when I try to import cv2 with python 2, it work fine.

the problem is I want to use Open CV with my python 3. Can anyone help me? how can I modify Open CV and that It work fine with my python 3. Please...

Thankyou.

edit retag flag offensive close merge delete

Comments

please, no screenshots of code or errors here. (ppl can't quote you, they're useless for search, stealing other ppls bandwidth, etc)

please edit your question, and replace with a TEXT version, thank you

berak gravatar imageberak ( 2020-06-26 04:38:13 -0600 )edit

how did you install this ?

if it was via pip, maybe you have to use pip3 instead ?

berak gravatar imageberak ( 2020-06-26 04:51:13 -0600 )edit

Thank for your advice, sir.

Sai Nyi gravatar imageSai Nyi ( 2020-06-28 05:11:19 -0600 )edit

2 answers

Sort by ยป oldest newest most voted
0

answered 2020-06-28 05:12:46 -0600

Sai Nyi gravatar image

I just solved this problem by downgrade my open CV version from 4.x to 3.x . Now, it work fine on my python 3.

edit flag offensive delete link more
0

answered 2020-06-26 04:49:13 -0600

supra56 gravatar image

updated 2020-06-26 05:08:04 -0600

Just remove dot before cv2 from .cv2 import * to:

from cv2 import *
edit flag offensive delete link more

Comments

@Sai Nyi. Mostly programmer never used this from .cv2 import *

supra56 gravatar imagesupra56 ( 2020-06-26 05:17:11 -0600 )edit

On Raspberry pi, do you two python python 2 and python 3? What's raspberry pi model you have? Python 2 is not available anymore. Actually, you install wrong cmake. You will have start all over again. As for me, I have 3B/+; 4B/4g/8g. With 4B, can take at least 45 minutes. Next time used sudo pip3 as root or pip3 as currently folder.. As for now, The officially used python 3. One thing are you using Debian Buster ver 10?

supra56 gravatar imagesupra56 ( 2020-06-26 05:57:23 -0600 )edit
1

ATT moderator. I accidentally deleted holger's answer

supra56 gravatar imagesupra56 ( 2020-06-26 06:21:37 -0600 )edit

Thankyou Sir

Sai Nyi gravatar imageSai Nyi ( 2020-06-28 05:05:27 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2020-06-26 04:25:12 -0600

Seen: 1,077 times

Last updated: Jun 28 '20