Convert Python to EXE and DLL
Convert Python to EXE and DLL
Simple Guide for Beginners
What is EXE?
EXE is a Windows executable file that runs your Python program without installing Python.
Convert Python to EXE
pip install pyinstaller pyinstaller --onefile yourfile.py
After running the command, go to the dist folder and run your .exe file.
What is DLL?
DLL is a library file used by other programs. Python can create a .pyd file which works like a DLL.
Convert Python to DLL (.pyd)
pip install cython
# setup.py
from setuptools import setup
from Cython.Build import cythonize
setup(ext_modules=cythonize("yourfile.py"))
# build
python setup.py build_ext --inplace
Important Note
.pyd file works with Python only. For C#, use Python.NET instead of converting to DLL.
Conclusion
Use EXE for running apps and use Python.NET for integration with C#.
Comments
Post a Comment