“What I infer from your question is that you are trying to run pyinstaller on Mac and not on windows. If yes then this is what worked for me when I faced the same situation”
First Remember :
If you are working on Mac, then your standalone file generated will not have .exe extension, rather it would be .app
It looks like you installed pyinstaller correctly but its not in your bash “PATH” where bash looks for normally to run any installed program.
To check where pyinstaller is installed, run this command in the terminal
me:~ user$ sudo find pyinstaller ~/ | grep pyinstaller
here is the output I see on my mac
/Users/user//Library/Python/2.7/bin/pyinstaller
Now lets add this to PATH like this
me:~ user$ sudo nano /etc/paths (you can use vi instead of nano if you wish to)
here is sample output I see (yours might be a bit different)
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
go to last empty line and type ~/Library/Python/2.7/bin there
your file should now look like this
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
~/Library/Python/2.7/bin
save this edited file and quit the terminal.
- Open terminal again and this time terminal will have updated path. just type pyinstaller and press enter, you should get an output like this
me:~ user$ pyinstaller
sage: pyinstaller [-h] [-v] [-D] [-F] [--specpath DIR] [-n NAME]
[--add-data <SRC;DEST or SRC:DEST>]
[--add-binary <SRC;DEST or SRC:DEST>] [-p DIR]
[--hidden-import MODULENAME]
[--additional-hooks-dir HOOKSPATH]
[--runtime-hook RUNTIME_HOOKS] [--exclude-module EXCLUDES]
[--key KEY] [-d {all,imports,bootloader,noarchive}] [-s]
[--noupx] [--upx-exclude FILE] [-c] [-w]
[-i <FILE.ico or FILE.exe,ID or FILE.icns>]
[--version-file FILE] [-m <FILE or XML>] [-r RESOURCE]
[--uac-admin] [--uac-uiaccess] [--win-private-assemblies]
[--win-no-prefer-redirects]
[--osx-bundle-identifier BUNDLE_IDENTIFIER]
[--runtime-tmpdir PATH] [--bootloader-ignore-signals]
[--distpath DIR] [--workpath WORKPATH] [-y]
[--upx-dir UPX_DIR] [-a] [--clean] [--log-level LEVEL]
scriptname [scriptname ...]
pyinstaller: error: too few arguments
- now cd into the folder that has your program’s .py file and type following command to get standalone mac app
Simply run this command to create standalone program for macOS. it’s name would be the same as your .py file name
me:~ user$ pyinstaller --windowed --onefile filename.py
if you want a different name for your standalone program then use following command
me:~ user$ pyinstaller --windowed --onefile --name myapp filename.py
if you want to add custom icon to your newly created standalone program then use following command
(before running this command make sure your icon flies in the same directory as your .py file)
me:~ user$ pyinstaller --windowed --onefile --icon "custom_icon.icns" --name myapp filename.py
If you did not get any of the above working for you then try giving complete path to pyinstaller in the command like this
me:~ user$ /Users/user//Library/Python/2.7/bin/pyinstaller --windowed --onefile filename.py
OR
me:~ user$ ~/Library/Python/2.7/bin/pyinstaller --windowed --onefile filename.py