Q:

python cython ImportError: DLL load failed: %1 is not a valid Win32 application

This is what i have done, but i failed in Step3, I try my best and can't find how to solve it.
step1: install python-2.7.12.amd64 , Cython-0.24-cp27-cp27m-win_amd64 and vs2015.3.com_enu.(there are some problems,but be soveled.)
step2: do as:http://docs.cython.org/src/quickstart/build.html
       .c and .pyd  files are generated.
step3: but when i import the model, failed with 

"traceback... file'',line 1, in   import...
  ImportError: DLL load failed: %1 is not a valid Win32 application"

what i should do for this problem? anyone some advances? thanks very much.

A:

As @J.J.Hakala mentioned be sure to use the compiler he linked to or it won't work with your Python version.  Also make sure you have all your includes listed in setup.py, i.e.  
from Cython.Distutils import build_ext
from setuptools import setup
from setuptools import Extension

module = 'MyModule'

ext_modules = [Extension(module, sources=[module + ".pyx"],
              include_dirs=['path1','path2'], # put include paths here
              library_dirs=[], # usually need your Windows SDK stuff here 
              language='c++')]

setup(
    name = module,
    ext_modules = ext_modules,
    cmdclass = {'build_ext': build_ext},
    include_dirs = ['path1', 'path2']
)

And while building be sure to specify: python setup.py build_ext --compiler=msvc in case you have multiple compilers on your system.  While you're at it they note that you need setuptools version >=6.0 so ensure you are up to date there.

