How to change compiler settings for build Python extensions

Sometimes choose Python distutils settings which you are not expect. Where do this come from?

asked: 2015-03-11 by: cgrzemba


cgrzemba answers:

These settings are defined if Python was build and stored in

/opt/csw/lib/python/_sysconfigdata.py

The variables of this file can be overridden by settings evironment variables like:

$ CC=gcc LDSHARED="gcc -shared -mcpu=v9 -Wa,-xarch=v8plus -L/opt/csw/lib" \
> python setup.py build_ext