Reputation: 51
I have a large Python project consisting of multiple scripts and importing some heavy libraries like PyTorch.
I need to use this project as a part of the final solution made in .NET.
Moreover, it should be standalone and distributable, since setting up a Python environment on the customer's side is not an option.
The best way is to be able to make a DLL or static library, but any alternative way such as executable works just fine.
PyInstaller, Nuitka.
In both cases, I have encountered some dead-end issues with one or more packages. E.g. Nuitka failing with PyTorch
There is the prototype of the final solution which relies on RPC communication between running Python and .NET programs.
But distribution and source code protection are unresolvable issues with the architecture.
Update: The target platform is Windows
Upvotes: 5
Views: 4684
Reputation: 2581
you can try py2exe, pyinstaller:
Step 1. pip install pyinstaller.
step 2. new python file let's name it code.py
.
step 3. Write some lines of code i.e print("Hello World")
step 4. Open Command Prompt in the same location and write pyinstaller code.py hit enter. Last Step see in the same location two folders name build, dist will be created. inside dist folder there is folder code and inside that folder there is an exe file code.exe along with required .dll files
Upvotes: 1