Skip to content

Pyinstaller

Nanni Bassetti edited this page Feb 27, 2023 · 33 revisions

This is a brief guide to explain our steps to make a binary file from fit.py. For more information about pyinstaller go here

Prerequisites

Make sure you have installed FIT on your development machine as explained in the fit repository

Windows

Below you find are the steps taken to create an executable on windows 11 whit Git Bash.

  • First you need to install pyinstaller in your poetry virtualenvs. To do this, just to type the command poetry add pyinstaller. Currently (version 5.8.0) it's possible after the command you receive the following error. To resolve it just replace the python property in the pyproject.toml file from python = "^3.9" to python = ">=3.9,<3.12".

image

  • From command promt type:
pyinstaller --distpath=./pyinstaller/windows/dist --workpath=./pyinstaller/windows/build ./pyinstaller/windows/fit-console.spec

or

pyinstaller --distpath=./pyinstaller/windows/dist --workpath=./pyinstaller/windows/build ./pyinstaller/windows/fit-no-console.spec
  • Copy asset and whois directories in the dist dir:
cp -r asset/ pyinstaller/windows/dist/asset
cp -r whois/ pyinstaller/windows/dist/whois
  • Go to dist dir and launch fit:
cd pyinstaller/windows/dist/; ./fit.exe
  • If you don't use spec file:
pyinstaller --noconfirm --onefile --console --clean --add-data ./whois/data;./whois/data --additional-hooks-dir=./pyinstaller/windows/hooks --icon=../icon.png --specpath=./pyinstaller/windows/ --distpath=./pyinstaller/windows/dist --workpath=./pyinstaller/windows/build fit.py

or

pyinstaller --noconfirm --onefile --windowed --clean --add-data ./whois/data;./whois/data --additional-hooks-dir=./pyinstaller/windows/hooks --icon=../icon.png --specpath=./pyinstaller/windows/  --distpath=./pyinstaller/windows/dist --workpath=./pyinstaller/windows/build fit.py
Clone this wiki locally