On the official website of Python.NET, it says it supports Python 3.8. Great. Now I am interested to call my existing python 3.8 modules from an application developed in C# (.NE
As mentioned here, Anaconda (and Miniconda) do not works with Python.NET. All I had to do was to reinstall a fresh copy of Python with all the package I needed and replace the following piece of code with the new paths:
string pythonPath1 = @"C:\Python";
string pythonPath2 = @"C:\Python\Lib\site-packages";
The official way to install Python.NET is via Python package manager pip
.
On Windows, that would be python.exe -m pip install pythonnet
. That will create Python.Runtime.dll
somewhere in your Python distribution. Just reference it from your project, and ensure architectures match.
An unsupported alternative is to use my unofficial build, and set Runtime.PythonDLL
to the location of python38.dll
of your choice (you can find one at runtime using another NuGet package: WhichPython).