如何让 lxml 在 IronPython 下工作?

发布于 2024-07-29 00:45:51 字数 205 浏览 3 评论 0原文

我需要将一些严重依赖 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 技术交流群。

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

发布评论

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

评论(2

翻身的咸鱼 2024-08-05 00:45:51

您可以查看 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.

过气美图社 2024-08-05 00:45:51

您可能已经考虑过:

另一种方法是首先将 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.

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