1

Using PyInstaller I created a executable from a python script as follows:

pyinstaller --onefile pythonScriptName.py

However, when I run the executable I get an error ImportError: No module named 'MyModule'. 'MyModule' is a placeholder name for a custom module I use in the script. So I'm assuming that PyInstaller didn't package up the custom modules. Is there some way to get it to do that?

the_pied_shadow
  • 145
  • 2
  • 8
  • Where is you custom module located ? If it's being imported in `pythonScriptName.py`, then you can tell pyinstaller to search for it in any additional folders using `--paths "/location/of/folder"`. If it's not visible through any import statement, you could also use `--hidden-import modulename` along with this... – gdcodes Dec 18 '21 at 03:55
  • This discussion says the same things too https://stackoverflow.com/questions/15114695/imported-module-not-found-in-pyinstaller The question is for windows, but these flags aren't platform specific and have worked for me on macOS as well – gdcodes Dec 18 '21 at 03:55

0 Answers0