Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use MinGW's gcc compiler when installing Python package using Pip?

I configured MinGW and distutils so now I can compile extensions using this command:

setup.py install 

MinGW's gcc compiler will be used and package will be installed. For that I installed MinGW and created distutils.cfg file with following content:

[build] compiler = mingw32 

It's cool but now I'd like to use all pip benefits. Is there a way to use the same MinGW's gcc compiler in pip? So that when I run this:

pip install <package name> 

pip will use MinGW's gcc compiler and compile C code if needed?

Currently I get this error: Unable to find vcvarsall.bat. Seems pip doesn't know that I have gcc compiler. How can I configure pip to use gcc compiler?

like image 571
demalexx Avatar asked Jul 21 '10 07:07

demalexx


People also ask

How do I use python MinGW?

MinGW is an alternative C/C++ compiler that works with all Python versions up to 3.4. Install Minimalist GNU For Windows into C:\MinGW. Open MinGW Installation Manager, check mingw32-base and mingw32-gcc-g++, and Apply Changes in the Installation menu. Add C:\MinGW\bin to the PATH environment variable.


1 Answers

  • install MinGW with C++ Compiler option checked
  • add C:\MinGW\bin to your PATH
  • in PYTHONPATH\Lib\distutils, create a file distutils.cfg and add these lines:
[build] compiler=mingw32 
like image 192
Syl Avatar answered Sep 20 '22 13:09

Syl