如何在构建python扩展时指定链接器?

ate*_*rel 4 python gcc macports

我使用macports gcc-4.6安装了python2.7.当我构建扩展模块(python setup.py build_ext)时,会调用正确的gcc(/ opt/local/bin/gcc)但错误的链接器(它调用/ Developer/usr/bin/clang).有没有办法覆盖python链接的调用?

tit*_*ito 8

您可以自定义与LDSHARED环境变量一起使用的链接器:

LDSHARED=/usr/bin/ld python setup.py build_ext
Run Code Online (Sandbox Code Playgroud)