Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run python module in C#?

I've been banging my head for the past two days trying to find out if it's possible to run a python module in C#. The module I'm interested in is Sympy which can be found here http://code.google.com/p/sympy/ (in case anyone's interested). It's a math library, and this one does what I need it to do. I haven't found a C# library which is as good (I tested math.net and others..)

From searching google I found out that you can execute python code inside C# using IronPython. Haven't found any real good example of using a module with IronPython or with PythonNet.

Can anyone tell me if it's possible to use a python module in C# and what would he recommend IronPython or PythonNet. Also if it's possible, does it mean my APP will need the python compiler installed to work or will the referenced dll be enough?

like image 657
Bogdan Avatar asked Jun 11 '26 02:06

Bogdan


1 Answers

I don't know how well loading a python lib in c# will do ya, but I'd write my program via IronPython.

you can then compile it to an exe so your users don't know the difference.

now this is guesswork, but maybe you can then load your assembly in other c# projects and use it that way. i.e. wrap the python library with ironpython and then load that in c#

its not elegant, but it'll work, I bet.

like image 54
Oren Mazor Avatar answered Jun 13 '26 14:06

Oren Mazor



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!