C#如何使用python程序?

发布于 2024-09-06 17:36:45 字数 85 浏览 2 评论 0原文

如果不使用ironpython,C#如何使用cpython程序(py文件)?

因为ironpython加载cpython代码存在一些bug。

If it doesn't use ironpython, how C# use cpython program(py file)?

Because there are some bugs that ironpython load cpython code.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

|煩躁 2024-09-13 17:36:45

如果您需要严格的 CPython 行为并且不想更改 Python 程序,恐怕在这种情况下您应该生成单独的 CPython 进程,并通过某些 RPC 协议(有很多可供选择)通过管道或网络连接到本地主机与其进行交互。

作为“序列化”RPC 的替代方案,您可以使用系统的设施,例如,如果您使用的是 Windows,则使用 COM,或者使用 Linux 上的 D-Bus - 但这会使代码依赖于平台,并且不一定更简单。

If you need strict CPython behavior and do not want to change Python program I am afraid that in this case you should spawn separate CPython process and interact with it via some RPC protocol (there are plenty to choose from) via pipe or network connection to localhost.

As alternative to "serialized" RPC you might use system's facilities e.g. COM if you're on Windows or D-Bus on Linux - but this would make code platform dependent and not necessarily simpler.

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