Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python does not consider distutils.cfg

I have tried everything given and the tutorials all point in the same direction about using mingw as a compiler in python instead of visual c++.

I do have visual c++ and mingw both. Problem started coming when I wanted to install using pip. It always gave Unable to find vcvarsall.bat

So as per suggestions I created a file distutils.cfg under the following path c:/python27/Lib/distutils/ and added the following two lines:

[build]
compiler=mingw32

However, this file has no effect whatsoever. The same error still exists while using pip. I am trying to install numpy by the way currently although the error came earlier also.

like image 769
Sohaib Avatar asked Aug 20 '13 21:08

Sohaib


People also ask

Where do I put Distutils CFG?

Location and names of config files For Python 1.5. 2, the Distutils will normally be installed to prefix/lib/python1. 5/site-packages/distutils , so the system configuration file should be put there under Python 1.5.

What is distutils python?

The distutils package provides support for building and installing additional modules into a Python installation. The new modules may be either 100%-pure Python, or may be extension modules written in C, or may be collections of Python packages which include modules coded in both Python and C.

What is Python setup CFG?

The setup. cfg is an ini file, containing option defaults for setup.py commands. You can pretty much specify every keyword we used in the setup.py file in the new setup. cfg file and simply use the setup.py file as the command line interface.

Is setup py deprecated?

You may still find advice all over the place that involves invoking setup.py directly, but unfortunately this is no longer good advice because as of the last few years all direct invocations of setup.py are effectively deprecated in favor of invocations via purpose-built and/or standards-based CLI tools like pip, build ...


1 Answers

Cost me several hours to figure this out but now works like a charm. I am on Windows 64bit and using a scientific Python distribution Enthought Canopy.

  1. Ensure you have installed MinGW and the Compilers you need (C, C++, Fortran..)

  2. Add C:\MingW\bin to your PATH in Environment variables

  3. In C:\Users\MyName\AppData\Local\Enthought\Canopy32\App\appdata\canopy-1.6.2.3262.win-x86\Lib\distutils, create with notepad++ or similiar a new file distutils.cfg

Write and save:

[build]
compiler = mingw32

[build_ext]
compiler = mingw32
like image 99
Philipp Schwarz Avatar answered Oct 15 '22 09:10

Philipp Schwarz