Installing OpenCV on Windows 7 for Python 3.2.3 [duplicate] - windows

am trying desperately to get OpenCV to work on Windows 7. I download and installed it, and it didn't work, I got
ImportError: No module named opencv
when I tried to run one of the samples. I google my problem and got only random solutions that don't work. Can anybody guide me in installing it, or know where i can get a clear installation guide design for a programming noob.

As of OpenCV 2.2.0, the package name for the Python bindings is "cv".The old bindings named "opencv" are not maintained any longer. You might have to adjust your code. See http://opencv.willowgarage.com/wiki/PythonInterface.
The official OpenCV installer does not install the Python bindings into your Python directory. There should be a Python2.7 directory inside your OpenCV 2.2.0 installation directory. Copy the whole Lib folder from OpenCV\Python2.7\ to C:\Python27\ and make sure your OpenCV\bin directory is in the Windows DLL search path.
Alternatively use the opencv-python installers at http://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv.

I have posted a very simple method to install OpenCV 2.4 for Python in Windows here : Install OpenCV in Windows for Python
It is just as simple as copy and paste. Hope it will be useful for future viewers.
Download Python, Numpy, OpenCV from their official sites.
Extract OpenCV (will be extracted to a folder opencv)
Copy ..\opencv\build\python\x86\2.7\cv2.pyd
Paste it in C:\Python27\Lib\site-packages
Open Python IDLE or terminal, and type
>>> import cv2
If no errors shown, it is OK.
UPDATE (Thanks to dana for this info):
If you are using the VideoCapture feature, you must copy opencv_ffmpeg.dll into your path as well. See: https://stackoverflow.com/a/11703998/1134940

I have posted an entry to setup OpenCV for Python in Windows:
http://luugiathuy.com/2011/02/setup-opencv-for-python/
Hope it helps.

Actually you can use x64 and Python 2.7. This is just not delivered in the standard OpenCV installer. If you build the libraries from the source (http://docs.opencv.org/trunk/doc/tutorials/introduction/windows_install/windows_install.html) or you use the opencv-python from cgohlke's comment, it works just fine.

download the opencv 2.2 version from https://sourceforge.net/projects/opencvlibrary/files/opencv-win/
install package.
then Copy cv2.pyd to C:/Python27/lib/site-packeges.
and it should work:
import cv2

open command prompt and run the following commands (assuming python 2.7):
cd c:\Python27\scripts\
pip install opencv-python
the above works for me for python 2.7 on windows 10 64 bit

One thing that needs to be mentioned. You have to use the x86 version of Python 2.7. OpenCV doesn't support Python x64. I banged my head on this for a bit until I figured that out.
That said, follow the steps in Abid Rahman K's answer. And as Antimony said, you'll need to do a 'from cv2 import cv'

Installing OpenCV on Windows 7 for Python 2.7

Related

How do I download PyPy?

I run Windows 10 64 bit.
I haven't tried downloading PyPy because I didn't find any tutorials on YouTube.
I have also went to the official PyPy website but it is for Python 3.6
Do I need to have python 3.6 downloaded too?
Also tell the steps to download PyPy
Edit: I am having problems in installing modules too. It gives a GINORMOUS error saying I need wheel, and some compilers like G77, GNU, Visual C++, etc.
If I understand you correctly, I dont think you need python 3.6 installed,
If you have already downloaded pypy from the website, extract the file by right-clicking on it and run the .exe file. Then run pypy and you shouldn't have any problems from there on.
Hope my advice is useful.

How can i have Tessaract on Windows?

I am working on a Text Recognition Solution and I need to use Tesseract on Windows OS.
Is there a command line to know if it's already installed? If not how can I get it?
Installer for Windows for Tesseract 3.05 and Tesseract 4 are available from Tesseract at UB Mannheim. You can read more about it here. You need to install it, windows does not come preinstalled.
You need to install tesseract using windows installer available here. Then you should install the python wrapper as:
pip install pytesseract
Then you should also set the tesseract path in your script after importing pytesseract library as below (Please do not forget that installation path might be modified in your case!):
pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files (x86)\Tesseract-OCR\tesseract.exe'

How to install PyGObject in Anaconda under Windows 10?

I tried to run this simple code, which is about GUI programming in python usinh Python GTK+ 3:
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
win = Gtk.Window()
win.connect("destroy", Gtk.main_quit)
win.show_all()
Gtk.main()
I have anaconda 5.2 installed with Python 3.6 under Windows 10, and I get this error:
import gi
ImportError: No module named 'gi'
Even if I install anaconda 4.2 with Python 3.5 I get the same error.
I could not figure out how to install gi, which is apparently part of PyGObject.
using pip install PyGObject results in an error:
Failed building wheel for PyGObject
Can anybody help?
As I explain in this answer there are two ways (afaik) to install PyGObject in Windows.
If you use the .exe installer you'll be restricted to Python 3.4. I've never used it with Anaconda, but the installer (before automatically checking for Python interpreter installations) lets you select "portable" installations of the interpreter (I believe this might be the way to point to a virtual environment interpreter, maybe a conda installed interpreter, I've never used it though). You can try and let it try to find your interpreter automatically and if it doesn't then you can cancel the install and re try with the "portable" approach.
If you use MSYS2 I really don't know how you can make it work. You'll have to use the included pacman instead of Anaconda to manage your packages, so I don't know if this is what you want.

git-cola will not run on windows

I have installed git-cola using the setup installer for windows. I pointed it to proper installs of git and python.
When I try to launch git-cola, nothing happens whatsoever.
Is there something I am missing here?
I had the same problem, in my case it was missing PyQt4 library. You can install PyQt4 by downloading an appropriate installer from Binary Packages section on PyQt4 Riverbank website.
How I investigated the issue
When I installed git-cola in a default directory and tried to run it using a command line
C:\Program Files (x86)\git-cola\bin>python git-cola.pyw
I got
Sorry, you do not seem to have PyQt4 installed.
Please install it before using git-cola.
e.g.: sudo apt-get install python-qt4
Note
I have two Python 2.7 installations, one at c:\program\Python27 and another at C:\Users\UserName\Anaconda2, I used the first one. I also installed Python SIP some time ago, I'm not sure if it required by git-cola.

Install wxpython on mac

I am new to Mac, have always used windows and I am confused on how to install wxPython. I downloaded the .dmg file from the website, and it contained three files:
a pkg file, a readme, and an uninstall.py
I opened the pkg file, went through the steps, and Im not sure where it installed after it said "Installation Complete"
Also, I did the import wx in idle, which caused a stacktrace error.
Thanks.
From personal experience on installing wxPython on both Windows 7 and Mac OSX, I found restarting the computer helps out after installation and stacktrace errors appearing in the Shell upon 'import wx'. Sounds simple enough, but it worked for me. If no errors appear after 'import wx', that means wxPython installed correctly. To add to bouke's answer above, the current way to install Python 2.7 via homebrew in Terminal:
brew install python
To install wxPython:
brew install wxpython
At least for development, I would suggest to install (python and) wx using homebrew. It will install version 2.9 and you're ensured that Apple-provided system libraries remain untouched.

Resources