Monday, February 10, 2014

Using MinGW instead of Visual Studio with Python


I was trying to install certain Python packages on a new system I was getting the following error:
error: Unable to find vcvarsall.bat
I don't use visual studio, instead I use MinGW, so the following steps were needed:

  1. Install MinGW
  2. Add the path to the MinGW bin folder to the system path
  3. Edit or create the distutils.cfg located in your PYTHON\Lib\distutils folder
  4. Add the following to the cfg file

[build]
compiler=mingw32

I also got the following error
gcc: error: unrecognized command line option '-mno-cygwin'
error: command 'gcc' failed with exit status 1
There is probably a better solution but until I can find one I edited the '-mno-cygwin' switch out of the cygwinccompiler.py file.  It shows up on 4 lines around line 322.

Edit 4/27/15: It looks like the -mno-cygwin issue has been resolved in more recent releases of distutils.

No comments: