- Notifications
You must be signed in to change notification settings - Fork750
the program can not quit normally when I import native python package, for example: numpy#1746
Unanswered
yunzhizhou asked this question inQ&A
-
Environment
Details
usingPython.Runtime;Environment.SetEnvironmentVariable("PATH",Path.GetFullPath(@"C:\\Users\\admin\\anaconda3\\envs\\pm3env"),EnvironmentVariableTarget.Process);PythonEngine.PythonHome="C:\\Users\\admin\\anaconda3\\envs\\pm3env";using(Py.GIL()){// dynamic np = Py.Import("numpy");// Console.WriteLine(np.cos(np.pi * 2));dynamicos=Py.Import("os");Console.WriteLine(os.listdir());}PythonEngine.BeginAllowThreads();Console.WriteLine("press Ctrl+C to quit");Console.ReadKey();
usingPython.Runtime;Environment.SetEnvironmentVariable("PATH",Path.GetFullPath(@"C:\\Users\\admin\\anaconda3\\envs\\pm3env"),EnvironmentVariableTarget.Process);PythonEngine.PythonHome="C:\\Users\\admin\\anaconda3\\envs\\pm3env";using(Py.GIL()){dynamicnp=Py.Import("numpy");Console.WriteLine(np.cos(np.pi*2));}PythonEngine.BeginAllowThreads();Console.WriteLine("press Ctrl+C to quit");Console.ReadKey(); |
BetaWas this translation helpful?Give feedback.
All reactions
Replies: 0 comments
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Labels
None yet
Converted from issue
This discussion was converted from issue #1702 on March 30, 2022 13:53.