How to install Python.NET for C# (VS2019) on Windows 10 and for Python 3.8?
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";
Python.Net distribution with my application: online or offline install?
The upcoming Python.NET 3.0 won't need to be installed using pip
to enable embedding of Python into .NET projects. You can build it from GitHub src/runtime
directory or get the latest monthly preview build from NuGet.org.
Your app will need to set Runtime.PythonDLL
to the full path of python39.dll
and PythonEngine.PythonHome
to Python home directory (on Windows this is usually the directory where python39.dll
is located).
How to fix error during pythonnet installation
From the Python.NET docs I can see it doesn't support python 3.9
. You can download wheel file from
here.
As your python
version is 3.9, download pythonnet‑2.5.2‑cp39‑cp39‑win32.whl
(for 32-bit python
version) or pythonnet‑2.5.2‑cp39‑cp39‑win_amd64.whl
(for 64-bit python
version).
Then specify a full path to wheel file for installation.
Example:
pip install C:\Users\User\Downloads\pythonnet‑2.5.2‑cp39‑cp39‑win_amd64.whl
How do I distribute Python with a .Net application as one installation executable?
I do not have experience with C#, but you could try to compile the python script using
pyinstaller, which compiles python code to a stand-alone executable.
Then, you can try embedding this executable into your C# program, as discussed here.
Related Topics
C# Linq to SQL: Refactoring This Generic Getbyid Method
Publish .Net Core App as Portable Executable
Check If a String Is a Palindrome
Multiple Insert Statements in One Connection
Spawn a New Thread to Open a New Window and Close It from a Different Thread
Htmlagilitypack and Dynamic Content Issue
Recursive Linq Query: Select Item and All Children with Subchildren
Check a String to See If All Characters Are Hexadecimal Values
How to Check If a Given Value Is a Generic List
What Is Difference Between Regasm.Exe and Regsvr32? How to Generate a Tlb File Using Regsvr32
Document.Ready() Is Not Working After Postback
How to Use HTML.Textboxfor with Input Type=Date
Capturing Count from an SQL Query
Mono on Debian: Could Not Find File "/Srv/Www/Proj/Bin\Roslyn\Csc.Exe"
Passing Eval from Aspx to JavaScript Function as Parameter
Printing a Formatted HTML Page in C#