PyInstaller not working on simple HelloWorld Program

Run with the -F flag to produce the standalone exe:

pyinstaller -F helloworld.py

It will output to dist/helloworld.exe

NOTE this is a different location to when -F is not used, be sure to run the right exe afterwards.


Thanks @tul! My version of pyinstaller put it to dist\helloworld.exe though!

If you start it from C:\Python27\Scripts... that'll be C:\Python27\Scripts\dist... as well!

But whereever you have it, I recommend putting a batch file next to your .py to be able recompile any time with just a click:

I set it up so there is nothing but the .exe at the .py location and the temporary stuff goes to the temp dir:

@echo off
:: get name from filename without path and ext
set name=%~n0
echo ========= %name% =========

:: cut away the suffix "_build"
set name=%name:~0,-6%
set pypath=C:\Python27\Scripts
set buildpath=%temp%

if not exist %name%.py (
    echo ERROR: "%name%.py" does not exist here!
    pause
    exit /b
)

%pypath%\pyinstaller.exe --onefile -y %~dp0%name%.py --distpath=%~dp0 --workpath=%buildpath% --specpath=%buildpath%

I name it like the .py file plus "_build" and cut away the suffix in the batch script again. Voilà.