如何在 Python 模块设置中设置额外的链接参数? [英] How to set extra link argument in Python module setup?

查看:71
本文介绍了如何在 Python 模块设置中设置额外的链接参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用设置工具来构建 Python 模块,我需要添加额外的链接.参数 extra_link_args 不起作用.

I am using setup tools to build a Python module and I need to add extra links. Parameter extra_link_args is not working.

推荐答案

正如我所说,extra_link_args 不是设置的参数.应该是这样的:

As I said, extra_link_args is not an argument to setup. It would be like this:

extra_link_args = []

if platform.system() == 'Darwin':
    extra_link_args.append('-Wl,-rpath,' + lib_path)

setup(
    name='Mymodule',
    #extra_link_args = extra_link_args this is wrong
     ext_modules = [Extension("_mymodule", ["mycfile.c"],
                         depends=[],
                         libraries = [':mylib.a'],
                         extra_link_args = extra_link_args, #this is right
                   )],

这篇关于如何在 Python 模块设置中设置额外的链接参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆