Work with Python on Windows10 (using Bash on Ubuntu on Windows)

[Updated] Comments for OpenCV installation

So far, I used pre-packaged Python environment, WinPython for developing Python program. That was my local optimal solution for working with Python on Windows.

Followings are my current solution (and some problem I faced). (Anaconda or pyenv are optional for managing several Python environments.)

Install Python3 and pip

$ sudo apt-get install python3
$ sudo apt-get install python3-pip

Install numpy

$ sudo pip3 install numpy

Install scipy

$ sudo apt-get install libblas-dev liblapack-dev
$ sudo apt-get install gfortran
$ sudo pip3 install scipy

Install Pyside and pyqtgraph

$ sudo apt-get install libqt4-dev
$ sudo apt-get install cmake
$ sudo pip3 install PySide
$ sudo pip3 install pyqtgraph

Install opencv (with Anaconda)

$ conda install -c menpo opencv3=3.1.0

ref: Opencv3 :: Anaconda Cloud

ImportError: libopencv_ccalib.so.3.1: cannot enable executable stack as shared object requires: Invalid argument

When importing opencv (import cv2), I faced this error. This is a dynamic linking trouble and can be resolved by execstack command.

ref: rhel - chcon fails to fix "cannot enable executable stack as shared object requires" err under RHEL6 - Unix & Linux Stack Exchange

$ sudo apt-get install execstack
$ sudo execstack -c $HOME/anaconda3/lib/libopencv_*
$ sudo apt-get install gtk2.0-0

[Update] This works well for

>>> import cv2

on Python interpreter however video related functions (such as cv2.VideoCapture) work unexpectedly. The comments on menpo's opencv3 github repository is below.

This functionality is disabled in order to attempt to increase the probability that the automated builds will be useful for as large a range of people as possible. I have made no effort to get the FFMPEG/Video builds working. If this is a requirement I can likely remedy it by adding an FFMPEG conda package.

I believe Python2.7 + OpenCV2 is much easier way to get started with video related functions.

However if you persist to use Python3+, you have to choose some more complicated installation process. So I will post some alternative setting up process for Python3+ + OpenCV3.