Windows 下用 SWIG 打包 C/C++ 为 Python 接口的时候,需要用到 32-bit/64-bit 编译器,MSYS2 给出了个一揽子方案,安装见其。
本文主要记录 MSYS2 的简单配置。
1) 让 ls 显示多彩颜色,并使 ll 可用Modify "D:\msys64\home\PeterPan\.bashrc", add following alias,alias ls="/bin/ls --color=tty --show-control-chars"alias ll='ls -l'2) 配置 MSYS2
Right-click -> Options... -> config as Cygwin
That's all.3) 安装软件- gcc 的安装PeterPan@PeterPan-PC MINGW64 ~$ pacman -Sl | grep gcc #### check valid packagemingw32 mingw-w64-i686-gcc 5.3.0-1 [已安装]mingw32 mingw-w64-i686-gcc-ada 5.3.0-1mingw32 mingw-w64-i686-gcc-fortran 5.3.0-1mingw32 mingw-w64-i686-gcc-libgfortran 5.3.0-1mingw32 mingw-w64-i686-gcc-libs 5.3.0-1 [已安装]mingw32 mingw-w64-i686-gcc-objc 5.3.0-1mingw64 mingw-w64-x86_64-gcc 5.3.0-1 [已安装]mingw64 mingw-w64-x86_64-gcc-ada 5.3.0-1mingw64 mingw-w64-x86_64-gcc-fortran 5.3.0-1mingw64 mingw-w64-x86_64-gcc-libgfortran 5.3.0-1mingw64 mingw-w64-x86_64-gcc-libs 5.3.0-1 [已安装]mingw64 mingw-w64-x86_64-gcc-objc 5.3.0-1msys gcc 4.9.2-6msys gcc-fortran 4.9.2-6msys gcc-libs 4.9.2-6 [已安装]msys mingw-w64-cross-gcc 4.9.2-3PeterPan@PeterPan-PC MINGW64 ~$ pacman -S mingw-w64-i686-gcc #### will installed under D:\msys64\mingw32PeterPan@PeterPan-PC MINGW64 ~$ pacman -S mingw-w64-x86_64-gcc #### will installed under D:\msys64\mingw64注:启动不同的 shell (win32/win64) 会自动使用不同的 gcc(win32/win64),并且不会与外部其他程序安装的 gcc 冲突 :-)- swig 的安装PeterPan@PeterPan-PC MINGW64 ~$ pacman -Sl | grep swigmingw32 mingw-w64-i686-swig 3.0.6-1 [已安装]mingw64 mingw-w64-x86_64-swig 3.0.6-1 [已安装]msys swig 3.0.7-1PeterPan@PeterPan-PC MINGW64 ~$ pacman -S mingw-w64-i686-swig #### will installed under D:\msys64\mingw32PeterPan@PeterPan-PC MINGW64 ~$ pacman -S mingw-w64-x86_64-swig #### will installed under D:\msys64\mingw64完。