如何让 lxml 在 IronPython 下工作?
我需要将一些严重依赖 lxml 的代码从 CPython 应用程序移植到 IronPython。
lxml 非常 Pythonic,我想继续在 IronPython 下使用它,但它依赖于 libxslt 和 libxml2,它们是 C 扩展。
有谁知道允许在 IronPython 下使用 lxml 或没有这些 C 扩展依赖项的 lxml 版本的解决方法?
I need to port some code that relies heavily on lxml from a CPython application to IronPython.
lxml is very Pythonic and I would like to keep using it under IronPython, but it depends on libxslt and libxml2, which are C extensions.
Does anyone know of a workaround to allow lxml under IronPython or a version of lxml that doesn't have those C-extension dependencies?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以查看 IronClad,这是一个开源项目,旨在使 Python 的 C 扩展在 IronPython 中可用。
You might check out IronClad, which is an open source project intended to make C Extensions for Python available in IronPython.
您可能已经考虑过:
另一种方法是首先将 lxml 库移植到 IPy,然后移植您的代码(取决于代码大小)。 您可能必须为对 C 扩展的本机 C 调用编写一些 C# 包装器 —— 我不确定与 IPy 相关的问题(如果有的话)。
或者,如果您要移植的代码与 lxml 相比很小,那么也许您可以删除 lxml 依赖项并使用 .NET XML 库。
Something which you might have already considered:
An alternative is to first port the lxml library to IPy and then your code (depending on the code size). You might have to write some C# wrappers for the native C calls to the C extensions -- I'm not sure what issues, if any, are involved in this with regards to IPy.
Or if the code which you are porting is small, as compared to lxml, then maybe you can just remove the lxml dependency and use the .NET XML libraries.