Build python bindings with msvc

Try to fix some compile errors when build python bindings with msvc.

The python demo passed with these patches.

Please review.