之前是有一个文章关于pip使用mingw32编译Python扩展的文章,最近重装了一个Windows系统,发现出现了一些新问题。
其实本质还是和前文提到的方法相似指定使用mingw32编译。也可以将配置文件放置于:
C:\Python27\Lib\distutils 但是编译却出现了问题: D:\Software\MinGW\bin\gcc.exe -mno-cygwin -mdll -Wall -std=c99 -O3 -f
omit-frame-pointer -Isrc/ -IC:\Python27\include -IC:\Python27\PC -c src/winrand.
c -o build\temp.win32-2.7\Release\src\winrand.o
gcc: error: unrecognized command line option ‘-mno-cygwin’
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.
error: command ‘gcc’ failed with exit status 1 看起来是gcc不再支持-mno-cygwin参数了。(注意,这个应该是4.7+版本出现的问题)
需要修改C:\Python27\Lib\distutils\cygwinccompiler.py文件,将所有的-mno-cygwin替换为空