Sharing Scientific Python Learnings

Scientific Python on Windows

Why WinPython?

The are several alternatives for installing Python on Windows out there. However, if you’re working with scientific python packages like NumPy, SciPy, Matplotlib, OpenCV, etc, most of the times you’ll end up configuring Windows PATH, installing several Microsoft Visual C++ versions, compiling complicate things…we don’t want that! It also includes full support for PyQt!

WinPython is a standalone version of Python that brings a lot of stuff already installed and ready to use. Moreover you don’t mess with Windows PATH and you can install as many versions as you want (both Python 2 and 3!!).

How it works?

Extract the zip for whatever folder you want. Personally, I have a folder called “Python” where I keep both Python2 and Python3 installations;

Navigate to the installation folder, for example “WinPython-32bit-2.7.10.3” and you’ll find some scripts inside it. “WinPython Command Prompt.exe” is the one you want. Just double click it and you have a working Python console! Simple as that!

OpenCV (with FFMPEG) support

WinPython doesn’t ship with OpenCV. However is very simple to install it.

For Python 2

Run the installer which essentially extracts content for a specified folder (put it wherever you want, it really doesn’t matter since you’ll remove it later on);

Then navigate to this folder and go to “opencv\build\python\2.7”. Inside this folder you’ll find both x64 and x86 options. Choose it accordingly to your WinPython installation;

Inside the previous folder you’ll find a single file “cv2.pyd”. Copy it to “Python\WinPython-32bit-2.7.10.3\python-2.7.10\Lib\site-packages” where “Python\WinPython-32bit-2.7.10.3” is the folder where you installed WinPython.

For Python 3

Unfortunately, at the time of this writing, OpenCV does not include binaries for Python 3. But wait! There is a simple workaround too!