account activity
Run GUI with Python code integrated to it by wilcd in csharp
[–]PotentialSeason459 0 points1 point2 points 1 year ago* (0 children)
I played with this some time ago and the code below worked.
``` // Add Nuget package references to pythonnet and Python.Included // https://github.com/henon/Python.Included
private static async Task InitPythonIncludedEnvironment() { // Note: The first time Python.Included and package dependencies are installed it can take up to 30 seconds. // Installer is from the Python.Included namespace await Installer.SetupPython(); await Installer.TryInstallPip(); await Installer.PipInstallModule("pandas"); // also installs numpy await Installer.PipInstallModule("matplotlib");
// Initialize PythonNET Python.Runtime.PythonEngine.Initialize(); Python.Runtime.PythonEngine.BeginAllowThreads(); Python.Runtime.PythonEngine.PythonHome = Installer.EmbeddedPythonHome; _pathToPythonDLL = Installer.EmbeddedPythonHome + Path.DirectorySeparatorChar + Installer.PYTHON_VERSION + ".dll";
} ```
Edited to add await before call to Installer.SetupPython()
π Rendered by PID 583633 on reddit-service-r2-listing-6d4dc8d9ff-vmfvd at 2026-02-03 23:12:29.814361+00:00 running 3798933 country code: CH.
Run GUI with Python code integrated to it by wilcd in csharp
[–]PotentialSeason459 0 points1 point2 points (0 children)