且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在Windows UWP app中将Python与C#一起使用

更新时间:2022-10-20 13:11:56

由于框架的限制,当您通过沙箱运行应用程序时,由于框架限制,c#中的经典" python解释器(作为IronPython)在商店应用程序中不起作用./p>

有些人已经将完整的python解释器移植到WinRT 关于汞问题 .当然,由于框架的限制,整个标准库不可用. 这与WinRT一起使用,因此很可能在UWP上工作.

I started writing an application in Python, but I now want to switch to C# and UWP. I know that you cannot write a UWP app in Python, but I am trying to see if I can write some code in Python and access that code from C#.

For example, writing a class in Python that C# code can access as well. Is that possible? And if so, can Python access Microsoft's UWP APIs?

The main code will not be written in Python; that would be impossible. But can interoperability between C# and Python exist, perhaps with IronPython (.NET's Python)?

And how would I set up such a Visual Studio project? I have Python Tools for Visual Studio installed, but there was no built-in option to add a Python file to my UWP app.

'Classic' python interpreters in c# (as IronPython) don't work in store apps because of framework restrictions, as you run your app through a sandbox.

Some dude has ported the full python interpreter to WinRT on mercurial. Of course, due to framework restrictions, the whole standard library isn't available. This works with WinRT, so it will very likely work on UWP.