I have a .py file with some python package dependencies which I want to compile into a standalone .exe file with pyinstaller. However, when I try to run this .exe file isolated, I get an error of ModuleNotFoundError: No module named '<modulename>'
. However, importing os
runs fine, so I think it is a problem with non-builtin packages. How can I compile my .py file into a single, standalone executable with no external dependencies but retained functionality?
To be clear, I want the dependencies to be inside the executable, so I can put it onto a fresh install of windows or mac without a runtime error. The executable should be able to run properly even when completely isolated.