[英]How can I import a .PYD module in IronPython?
I'm trying to use a python package from IronPython. 我正在尝试使用IronPython的python包。 Everything works fine if I import regular python modules.
如果我导入常规的python模块,一切正常。
But when I try to do the following: 但是当我尝试执行以下操作时:
import win32ui
I get: 我得到:
No module named win32ui
I've hunted through the code in IronPython.Runtime.Importer and there's no mention of .pyd 我在IronPython.Runtime.Importer中搜寻了代码,没有提到.pyd
Anyone know a way around this? 有人知道解决这个问题的方法吗?
A .pyd file is a DLL. .pyd文件是DLL。 So unless IronPython (which is written in .net) can correctly load C DLLs written for CPython, you might be out of luck.
因此,除非IronPython(用.net编写)可以正确加载为CPython编写的C DLL,否则您可能会很不幸。
In fact, according to the IronPython FAQ , you are unfortunately unable to import .pyd files: 实际上, 根据IronPython FAQ ,很遗憾,您无法导入.pyd文件:
Q: How do I build and call into PYD libraries?
问:如何构建并调用PYD库?
A: IronPython does not support using PYDs built for CPython since they leverage implementation details of CPython.
答:IronPython不支持使用为CPython构建的PYD,因为它们利用了CPython的实现细节。 You can get a similar effect for new "PYD"s you would like to implement by writing them in C# or VB and building a DLL for .NET.
通过用C#或VB编写新的“ PYD”并为.NET构建DLL,可以获得与您想要实现的新“ PYD”类似的效果。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.