Install Opencv-Python on Raspi

Install Opencv-Python on Raspi

I'm working on getting OpenCV-Python installed onto a raspberry pi so that I can stream a video from the pi to my computer. I worked on the code in pycharm and got it to work running the .py files both on my computer, but I have been unable to get the file to work on the pi.

The root cause, I think, is that the OS on the pi is old. It's running python3.4 as the default, with pip 1.5 (I think that's right, its been a minute since I checked). When I attempted to run the program the first time, I got the 'no module cv2' error. Fair enough. Tried pip installing OpenCV-Python and everything has been a mess since then. That pip install fails, updating pip breaks pip, I think because python3.4 reached EOL a while ago, so that's a no go. I've tried installing different versions of Python, lots of different things.

Currently, I've got Python 3.6.5 installed. I ran the command to pip install OpenCV-Python there and the pi has been stuck on 'installing build dependencies' for over two hours now.

I realize this has been all over the place, so here's a hopefully concise question.

What do I need to do to get OpenCV-Python running on my raspberry pi?

Do I need a different version of Python? Of Pip? Dependencies? I think NumPy is the only one but I could be wrong. The possibly dumber question, this is possible, right?

A little extra tidbit, the end goal of this is for work, so I have to stay on the same OS image basically. I can install new libraries and versions of Python, but I can't upgrade entirely.

Sorry that this question is so scattered, yeesh. I'm happy to answer questions about the system etc.

2

1 Answer

the open cv in raspberry pi is a bit tricky. You need to setup the environment for open-cv to function correctly try checking this link its work for me

PS. Read the comment first the code has some error

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Alexander Ross
Author

Alexander Ross

Alexander Ross has covered the video game industry for a decade, writing deep dives on game design, esports tournaments, VR developments, and gaming culture.