gpt4 book ai didi

python - 从 wxpython 调用 .net dll

转载 作者:太空宇宙 更新时间:2023-11-03 17:29:26 25 4
gpt4 key购买 nike

我在 wxpython 中有一个事件处理程序,它应该调用 .net dll 并使用它。我在网上搜索了解决方案,但没有找到。请问有人可以告诉我该怎么做吗?我发现ironpython就是这样,但不知道!

提前致谢

最佳答案

使用 PIP 或下载 zip 文件安装 pythonnet。

将所有 pythonnet 文件(clr.pyd、nPython、nPython.pdb、Python.Runtime.dll、Python.Runtime.pdb)复制到 c:\python27\Lib\site-packages 文件夹中

现在从事件状态 python shell 导入 clr 并添加对 .net dll 的引用(不要在路径中添加 .dll 扩展名)并调用该 dll 的对象和方法。

import clr
clr.AddReference('c:\my\path\to\dllfile')

关于python - 从 wxpython 调用 .net dll,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32109382/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com