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

发布于 2025-01-07 15:42:21 字数 173 浏览 3 评论 0原文

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

I have python2.7 installed using macports gcc-4.6. When I build an extension module (python setup.py build_ext) the correct gcc (/opt/local/bin/gcc) gets called but the wrong linker (it call /Developer/usr/bin/clang). Is there a way to override the call that python is linking with?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

才能让你更想念 2025-01-14 15:42:21

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

LDSHARED=/usr/bin/ld python setup.py build_ext

You can customize the linker used with LDSHARED environment variable:

LDSHARED=/usr/bin/ld python setup.py build_ext
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文