C#如何使用python程序?
如果不使用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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您需要严格的 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.