Distutils compiler options configuration

…衆ロ難τιáo~ 提交于 2019-11-29 10:24:22

I actually export them to the environment, just like for autotools' configure:

export CC=/usr/local/bin/clang
export CFLAGS=-I${HOME}/include
export LDFLAGS=-lboost

If you also need to override the linker separately:

export LDSHARED=/usr/local/bin/clang -shared

And if you don't like exporting the settings to your environment, do something like this for a one-time setting:

CC=/usr/local/bin/clang CFLAGS=-I${HOME}/include python setup.py build

If you want to find out what the default options were when python was build, use python-config --<flag>. Some flags are cflags, ldflags, libs or includes.

Compiler options are taken from CPython’s Makefile. IOW they are the same as the ones used to compile Python. You can override most of them on the command line as Evert described.

The global distutils.cfg is something that a sysadmin can create to set default options, not a file that is installed with Python.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!