Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pyinstaller giving error ("Error loading Python ... no suitable image found")

I have this is issue with pyinstaller on Mac that gives this error when I click on the created executable:

[9888] Error loading Python lib '/Users/Faris/Downloads/as5/dist/startscreen/Python': dlopen: dlopen(/Users/Faris/Downloads/as5/dist/startscreen/Python, 10): no suitable image found.  Did find:
    /Users/Faris/Downloads/as5/dist/startscreen/Python: code signature invalid for '/Users/Faris/Downloads/as5/dist/startscreen/Python'

This is a GUI application that uses PIL and 4 PNG files. How can I fix this?

like image 617
Farisk1 Avatar asked Jun 04 '20 20:06

Farisk1


2 Answers

I had resolved the same trouble with the following:

  1. pip3 uninstall pyinstaller
  2. brew reinstall python
  3. brew install pyinstaller
like image 183
jun1okamura Avatar answered Oct 13 '22 23:10

jun1okamura


Take note that on macOS, python3.7.7 or + and python3.8.3 or + are giving the same error, because of the addition of a full-notarization signing for python to avoid gatekeeper alerts.

Just install Python 3.7.6 or Python 3.8.2

like image 20
Martí Climent Avatar answered Oct 14 '22 00:10

Martí Climent