Код: Выделить всё
static void Main()
{
string pythonLibPath = "/usr/lib/x86_64-linux-gnu/libpython3.10.so.1";
Runtime.PythonDLL = pythonLibPath;
PythonEngine.Initialize();
CallPythonScript();
}
static void CallPythonScript()
{
string currentDir = Directory.GetCurrentDirectory();
PythonEngine.PythonPath = currentDir;
using (Py.GIL())
{
dynamic pythonScript = Py.Import("main");
int result = pythonScript.add_numbers(5, 3);
Console.WriteLine($"{result}");
}
}
Код: Выделить всё
def add_numbers(a, b):
return a + b
Скажите, как это исправить
Подробнее здесь: https://stackoverflow.com/questions/784 ... -pythonnet