Autocomplete for OpenCV-Python in Windows not working

The reason it’s not working is because you’re using a .pyd file, which is essentially the same as a compiled .dll. Autocomplete works by reading the source .py files, which are plain text. Try installing the OpenCV and Intel Math Kernel Library optimized NumPy packages from Christoph Gohlke’s Python Extension Packages for Windows repository, which is frequently updated and a must-use resource for anyone who does any kind of scientific Python computing on Windows. Make sure you delete the cv2.pyd and numpy directories from site-packages first. These new packages will install the .py source files needed by the autocomplete engine in Sublime Text.


EDIT

OK, so I wrote the above because it worked well for a bunch of other packages. I’m a Python 3 guy, and I never installed OpenCV from Gohlke because it only has Python 2 bindings. After reading @CrazyCoder’s comment below, I booted up Win7, and indeed he’s absolutely correct (and I should have realized this before) – since OpenCV is written in C/C++, the only .py file included in the Gohlke package is cv.py, whose entire contents are as follows:

from cv2.cv import *

The rest is contained in cv2.pyd and a bunch of .dlls. The full OpenCV Windows distribution from opencv.org is a 291 MB download, which expands to 3 GB, and the few .py files in there are involved in building OpenCV, and aren’t any good for autocomplete purposes. So, unfortunately, I don’t know if there’s a solution to your problem at the moment. Just keep the docs handy, and perhaps check out OpenCV Computer Vision with Python from Packt/O’Reilly, published in April 2013.

Leave a Comment