Hi,
I replace Python.Runtime.dll to 3.7。 try to run BollingerBands_PythonNet。the OQ crash.
So i test the pythonnet example in VS
Code:
using (Py.GIL())
{
dynamic np = Py.Import("numpy");
Console.WriteLine(np.cos(np.pi * 2));
dynamic sin = np.sin;
Console.WriteLine(sin(5));
double c = np.cos(5) + sin(5);
Console.WriteLine(c);
dynamic a = np.array(new List<float> { 1, 2, 3 });
Console.WriteLine(a.dtype);
dynamic b = np.array(new List<float> { 6, 5, 4 }, dtype: np.int32);
Console.WriteLine(b.dtype);
Console.WriteLine(a * b);
Console.ReadKey();
}
and get output
Quote:
Fatal Python error: initfsencoding: unable to load the file system codec
ModuleNotFoundError: No module named 'encodings'
if I run it directly, i get this:
Quote:
Python.Runtime.PythonException: ModuleNotFoundError : No module named 'numpy'
in Python.Runtime.Runtime.CheckExceptionOccurred()
in Python.Runtime.PythonEngine.ImportModule(String name)
I found it,
https://github.com/pythonnet/pythonnet/issues/845just use
Code:
PythonEngine.PythonHome = @"d:\ProgramData\Anaconda3";
So, please add the PythonEngine.PythonHome
Thanks