Installing OpenCV with python Latest 2018 Step By Step
I just Finished Setting up OpenCV To work nicely with my python and c++ installations(Ohh god it was a tedious task) although I will be focusing on python only in this post.It took me around 3 hours to figure out how to set it up.Though I searched the whole StackOverflow, google but still no result.There were multiple results on google with different methods but none of them worked for me which in turn prompted me to write this post as I did insane combinations of solution from the internet.So here are my 2 cents -Installing OpenCV with python Latest 2018.
So here it is step by step OpenCV For python
1.Install Anaconda, as usual, i.e. next next next and done.
It will install python as well.
2.Download OpenCV from here(well I used 3.4.0 as it was latest at the time of writing)
4.Now more complex part starts
5.Find cv2.pyd in wherever you have your OpenCV installation in my case it is C:\opencv\build\python\2.7\x86
6. Paste it into your C:\Program Files\Python36\Lib\site-packages location or wherever you have installed python.
8.then type “import cv2″ and enter(if it gives error at this step then continue below at least I got error at this step)
9.Close cmd and reopen again in admin mode then type”py” or “python” then type “pip install numpy”
10. Then Type “pip install matplotlib” do this also in admin mode else it will fail.
11.then type”pip install opencv”
12.Then try doing 8 step again
13.If you still get an error then try this if you installed python using anaconda.
14.Ten try again step 8 again if it fails again then do this copy python3.dll in your python installations directory To anaconda.If it exists then rename the one in anaconda directory to python3.txt and then paste it there look at the below image.
This is the last step I did and then my OpenCV started working.If you are still stuck then god bless you.Ask community over StackOverflow there are really nice people out there.At least I didn’t found anything over StackOverflow at the time of writing this post.