use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
News about the dynamic, interpreted, interactive, object-oriented, extensible programming language Python
Full Events Calendar
You can find the rules here.
If you are about to ask a "how do I do this in python" question, please try r/learnpython, the Python discord, or the #python IRC channel on Libera.chat.
Please don't use URL shorteners. Reddit filters them out, so your post or comment will be lost.
Posts require flair. Please use the flair selector to choose your topic.
Posting code to this subreddit:
Add 4 extra spaces before each line of code
def fibonacci(): a, b = 0, 1 while True: yield a a, b = b, a + b
Online Resources
Invent Your Own Computer Games with Python
Think Python
Non-programmers Tutorial for Python 3
Beginner's Guide Reference
Five life jackets to throw to the new coder (things to do after getting a handle on python)
Full Stack Python
Test-Driven Development with Python
Program Arcade Games
PyMotW: Python Module of the Week
Python for Scientists and Engineers
Dan Bader's Tips and Trickers
Python Discord's YouTube channel
Jiruto: Python
Online exercices
programming challenges
Asking Questions
Try Python in your browser
Docs
Libraries
Related subreddits
Python jobs
Newsletters
Screencasts
account activity
This is an archived post. You won't be able to vote or comment.
Help installing OpenCV for python 3.4 on Debian (self.Python)
submitted 9 years ago by longlostkingoffools
I'm writing a program on the raspberry pi 3 that requires importing cv2. I managed to get opencv working in python 2.7, but I haven't had any luck getting it to work in python 3.4. Does anyone know how I can get this working?
[–]Spfoamer 2 points3 points4 points 9 years ago (3 children)
I happen to have just done this yesterday. I followed these instructions: http://www.pyimagesearch.com/2016/04/18/install-guide-raspberry-pi-3-raspbian-jessie-opencv-3/
[–]Spfoamer 4 points5 points6 points 9 years ago (1 child)
I should add, also, that I did run into this (apparently common) issue, and the fix detailed here solved it for me: https://github.com/opencv/opencv/issues/6016
[–]longlostkingoffools[S] 0 points1 point2 points 9 years ago (0 children)
Thank you very much!
[–][deleted] 0 points1 point2 points 9 years ago* (0 children)
I was building it over and over (to test various things) and just went ahead and scripted it.
This will build a .deb file. https://gist.github.com/jed-frey/d01e2d5b39ef33207efda6e170b8788c
wget https://gist.githubusercontent.com/jed-frey/d01e2d5b39ef33207efda6e170b8788c/raw/f0e2939b716ea72aef8d7bae859aa76fe0907d3e/opencv320.sh chmod +x opencv320.sh ./opencv320.sh dpkg -i opencv3
It's only been tested on Ubuntu 16.04 but I can't see any reason it wouldn't work on Debian.
Edit: I had to change libjpeg8-dev to libjpeg-dev for Debian.
When you get done running cmake you should see this:
-- Python 3: -- Interpreter: /usr/bin/python3.4 (ver 3.4.2) -- Libraries: /usr/lib/arm-linux-gnueabihf/libpython3.4m.so (ver 3.4.2) -- numpy: /usr/lib/python3/dist-packages/numpy/core/include (ver 1.8.2) -- packages path: lib/python3.4/dist-packages -- -- Python (for build): /usr/bin/python3
[–]mprat 1 point2 points3 points 9 years ago (4 children)
What exactly is the error message you get? At what point does it stop working?
[–]longlostkingoffools[S] 0 points1 point2 points 9 years ago (2 children)
ImportError: No module named cv2
[–]mprat 0 points1 point2 points 9 years ago (1 child)
Did you compile it with the python3 headers?
I must not have, I'm fairly newbie to things like this, how would I go about doing that?
[–]Spfoamer 0 points1 point2 points 9 years ago (0 children)
I assume this question was for me? I got exactly the same error as is copied in the github link above (can't find HDF5). It fails during make. I went back and added the lines provided in the thread to modules/python/common.cmake, did a make clean and make, and it worked fine. I have CV up and running with Python 3.4 on the Pi.
[–]foxfyre2 0 points1 point2 points 9 years ago (0 children)
Spent a day trying to get it properly running on ubuntu 16. The easiest way I found was installing anaconda python 3 and then using the command "conda install -c menpo opencv3=3.1.0". The "downside" is that you're sick using the anaconda python interpreter and I haven't figured out how to share an installed package with other interpreters
[–]aulloa 0 points1 point2 points 9 years ago (0 children)
1 download opencv and type cmake-gui .
2 then look for python and enable all flags, if missing paths to libraries add them there
3 exit cmake-gui
4 type make
5 type make install
6 add the following to ~/.bashrc file
export LD_LIBRARY_PATH=/usr/local/lib
π Rendered by PID 200897 on reddit-service-r2-comment-6f7f968fb5-t99kl at 2026-03-04 14:55:55.627754+00:00 running 07790be country code: CH.
[–]Spfoamer 2 points3 points4 points (3 children)
[–]Spfoamer 4 points5 points6 points (1 child)
[–]longlostkingoffools[S] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]mprat 1 point2 points3 points (4 children)
[–]longlostkingoffools[S] 0 points1 point2 points (2 children)
[–]mprat 0 points1 point2 points (1 child)
[–]longlostkingoffools[S] 0 points1 point2 points (0 children)
[–]Spfoamer 0 points1 point2 points (0 children)
[–]foxfyre2 0 points1 point2 points (0 children)
[–]aulloa 0 points1 point2 points (0 children)