SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Tue Sep 22, 2020 11:12 pm

All times are UTC + 3 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Thu Jul 04, 2019 9:53 am 
Offline

Joined: Fri Sep 28, 2012 8:16 am
Posts: 144
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/845
just use
Code:
PythonEngine.PythonHome = @"d:\ProgramData\Anaconda3";


So, please add the PythonEngine.PythonHome

Thanks


Top
 Profile  
 
PostPosted: Thu Jul 04, 2019 10:40 am 
Offline

Joined: Fri Sep 28, 2012 8:16 am
Posts: 144
I found another way:

create a shourtcut. and set the Start in: d:\ProgramData\Anaconda3


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 3 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group