I'm trying to embed Python in my .NET application.
I'm using Python 3.6.1 64-bit on Windows 10 and I have installed pythonnet 2.3.0 from PyPi using pip.
I've referenced Python.Runtime.dll from C:\Program Files\Python36\Lib\site-packages and have both Path and PYTHONHOME environment variables pointed to C:\Program Files\Python36\.
When I use .NET in Python everything is OK.
import clr
from System.Drawing import Point
p = Point(5, 5)
print(p)
prints {X=5,Y=5} as expected.
But when I call Python from .NET I get System.BadImageFormatException. For example, when calling Python.Runtime.PythonEngine.Initialize(); :
System.BadImageFormatException: 'Could not load file or assembly 'Python.Runtime, Version=2.3.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.'
Any thoughts?
Thanks in advance.
Platform targetin my project fromAny CPUtox64.