Replies: 2 comments 2 replies
|
@jimnoble Any luck? In my case I'm running under a windows container The exception: Can confirm that that the DLL does exists at FYI, this is the code I'm using to set var pythonDir = Path.Combine(Environment.CurrentDirectory, @"python");
Runtime.PythonDLL = Path.Combine(pythonDir, "python312.dll");
PythonEngine.PythonHome = pythonDir;
PythonEngine.Initialize(); |
|
** With miniconda 3 and python 3.12. Dockerfile: FROM mcr.microsoft.com/dotnet/runtime:6.0 AS base FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build ** in the program.cs Environment.SetEnvironmentVariable("PYTHONHOME", "/root/miniconda3/lib"); it takes me 2 days but it's working.. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Environment
Details
I am trying to run a C#/.NET console application that uses the Python.NET library to interpret Python scripts at runtime. I want this app to run on Linux with a Docker container.
The problem I am having is that Python.NET requires you to initialize the
Runtime.PythonDLLproperty with the path to the Python library binary.The answer on this post makes me suspect I am looking for a file named e.g. libpython3.12.so.
I have created a dockerfile (see below) that installs the
python:3image to a virtual environment and copies the result into my final environment. But I do not see any file named likelibpython3.12.so. If I try to provide the/app/python/bin/pythonexecutable (which does exist), Python.NET throws an exception (see below) that the file does not exist.I can't find an explicit guide to how this should be done, does one exist?
How should I configure my dockerfile, and what is the path to the
libpython*.sofile that I should assign toRuntime.PythonDLL?the
.dockerfile:The exception:
All reactions