C# calls the function of Cpython

2

This is the code I copy, and I want to learn to use Python.Runtime, but when it runs, it throws an exception.

"DLL" python2.7m "cannot be loaded: no specified module can be found. (the exception comes from HRESULT:0X8007007E). "

As a problem with a rookie. Thank you.

using Python.Runtime;
using System;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            using (Py.GIL())
            {
                dynamic np = Py.Import("numpy");
                dynamic sin = np.sin;
                Console.WriteLine(np.cos(np.pi * 2));
                Console.WriteLine(sin(5));
                double c = np.cos(5) + sin(5);
                Console.WriteLine(c);
                Console.ReadKey();
            }
        }
    }
}
c#
.net
cpython
python.net
pythonnet
asked on Stack Overflow Mar 21, 2018 by Y.HC • edited Mar 26, 2018 by denfromufa

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0