Home > Blockchain >  PyInstaller Executable File: ModuleNotFoundError - Pandas
PyInstaller Executable File: ModuleNotFoundError - Pandas

Time:03-28

Background: I have a .py script which uses c.10 libraries/dependencies (e.g., pandas numpy json) and the script also relies on a .ini file, which it looks for in the same dir as it is located.

I want to add this .py file to Windows Scheduler, but before I can, I must make the file executable.

Issue: I used PyInstaller to create an executable file. I also added -- onefile and -w when creating the .exe file. My issue is that when I attempt to run the main.exe (either by double-clicking or through cmd) I get the following Unhandled exception in script -

enter image description here

Help: I am trying to understand how this is happening, especially as my understanding of PyInstaller is that it would create an executable file, which would inc. everything the script needs to run (Note: I have double checked that the .py contains import pandas etc.

Can someone explain to me how I would troubleshoot this and/or if there are any key steps I may have obviously missed, which might be causing this?

CodePudding user response:

Try using this commandline for compiling your python file, pyinstaller.exe --onefile --noconsole --hidden-import pandas {Your_FILE_NAME}.py

  • Related