When we use pyinstaller to pack python script to exe application, we may get Failed to execute script Error. In this tutorial, we will introduce you how to fix.
Failed to execute script error looks like:
How to fix this error?
The simplest way is we pack python script to exe application with console based. Here is an example:
pyinstaller --noconfirm --onefile --console "E:/workspace-nlp/PythonScript/main.py"
Then, we will run main.exe with command prompt in windows 10.
As to us, we can find the reason why main.exe reports Failed to execute script error.
Install python socks library, you can read this tutorial:
Fix ModuleNotFoundError: No module named ‘socks’ Error – Python Tutorial
Finally, we will pack our python script again, we find this error is fixed.