Menu
pyinstaller problem solved>
                        </div>
                    </div> <!-- end s-content__media -->

                    <div class=

PyInstaller not working: Now Solved

In this article, I will be sharing with you how to solve one of the most annoying problems, python coders have to suffer from- "PyInstaller failed to exexcute script"

Pyinstaller is a package in python which bundles python programmable scripts into .exe files. This is mostly used when people want to share an app which they have made by python to people who don't have python installed. However there are a lot of errors associated with it:- failed to exexcute a script , missing modules , system could not find the file specified and so on..

pyinstaller error pyinstaller logo

The most common reason a PyInstaller package fails is that PyInstaller failed to bundle a required file. Such missing files fall into a few categories: Hidden or missing imports: Sometimes PyInstaller can't detect the import of a package or library, typically because it is imported dynamically.

How to solve it?

1st method

Follow the given steps:-

  1. Uninstall the version of python, you are using by going to This PC-> Uninstall or change a program-> Python 3x
  2. Go to official python website.
  3. Install the latest version of python according to your operating system from the Downloads menu.

  4. Ensure to check all the boxes given in the upper images
  5. Windows sometimes restricts pyinstaller to run certain builds which doesn't let it to make executables for some security purposes,
  6. It is recommended to install python in a drive where windows is not installed. For example- if Windows is installed in C:/ , install python in D:/
  7. Open terminal and type 'pip install pyinstaller'
  8. If you want to check, open powershell and type 'pyinstaller', terminal will display all the functions of pyinstaller.
  9. Happy Coding!
2nd Method (If first doesn't work)
  1. Locate where pyinstaller is installed after running the pip install command.
  2. On Windows, it is generally located in the Scripts subfolder inside the python folder
  3. Search for the following files:
  4. pyinstaller.exe
  5. pyi-makespec.exe
  6. pyi-set_version.exe
  7. pyi-bindepend.exe
  8. pyi-archive_viewer.exe
  9. Copy their path.
  10. Go to This PC-> System Properties-> Advanced System Settings-> Environment Variables-> Path-> Edit-> New
  11. Paste the copied paths there.
  12. Click on OK thrice as the dialog boxes close one by one
  13. you are good to go!!
  14. If you want to check, write a simple hello world program. Open powershell and type 'pyinstaller /path/to/yourscript.py'
  15. 2 folders will be created- Dist and Build
  16. Your exe will be in Dist folder, run it
  17. Congrats you have compiled your first executable.
  18. Happy Coding!