Search code examples
python-3.xvirtualenvsoftware-distributioninstallation-package

Packaging Pythons vitual environmet for distribution with single .exe


I have python project that I would like to distribute for users. Everything that is needed is installed in .venv folder. There are several .py files along with main.py. Is there a way to create an installation package that can be run on Windows PC that doesn't have Python installed?


Solution

  • There are several options for making an EXE from Python files. I use PyInstaller. You can use it to create the EXE and also a Windows installer (MSI file) that will grab all of the dependencies. You can install PyInstaller inside your Virtual Environment.

    One word of caution. You may end up with a dist (distribution) folder that is fairly large (hundreds of MB). This will depend on different libraries that are in your app. You can often pare it down folder size by judicious use of excludes in your spec file.