Build Python C Extension with Mingw

缺省Python会使用VC编译C Extension,但特定的Python需要特定的VC编译,我更加倾向于使用Mingw。
创建lib\distutils\distutils.cfg,其内容为
[build]
compiler = mingw32

gcc 4.6可能不识别-mno-cygwin,找到lib\distutils\cygwinccompiler.py,将其去掉。如下的命令指定使用mingw32
python setup.py config --compiler=mingw32 build --compiler=mingw32 install
python setup.py config --compiler=mingw32 build --compiler=mingw32 bdist_wininst

python setup.py config --compiler=msvc build --compiler=msvc bdist_wininst

你可能感兴趣的:(C++,c,python,C#,vc++)