简体   繁体   English

C#如何使用python程序?

[英]How C# use python program?

If it doesn't use ironpython, how C# use cpython program(py file)? 如果不使用ironpython,C#如何使用cpython程序(py文件)?

Because there are some bugs that ironpython load cpython code. 因为存在一些Ironpython加载cpython代码的错误。

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

As alternative to "serialized" RPC you might use system's facilities eg COM if you're on Windows or D-Bus on Linux - but this would make code platform dependent and not necessarily simpler. 作为“序列化” RPC的替代方法,如果您使用的是Windows或Linux上的D-Bus,则可以使用系统的功能,例如COM-但这将使代码平台依赖并且不一定更简单。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM