Has anyone been able to create a working standalone Windows .EXE file from a QGIS Python Script Using PyInstaller?
[GIS] Working Windows Standalone .EXE From QGIS Python Script Using PyInstaller
pyqgispythonqgisstandalone
pyqgispythonqgisstandalone
Has anyone been able to create a working standalone Windows .EXE file from a QGIS Python Script Using PyInstaller?
Best Answer
I managed to get it working by updating the .spec file to copy the missing qgis plugin folder into the .exe bundle. I also had to add a check in the code to see if i'm running bundled so I can choose the correct path to the bundled qgis_plugins folder. I assume a better long term fix would be to make this into a runtime hook but for now this is sufficient.
Here is the code to check the whether bundled or not...
Here is the One File spec file contents...
Here are the CLI commands...
Create a command CLI window by running the OSGeo4W.bat file in the C:\OSGeo4W64 directory then update the path as follows...
Set the PYTHONPATH variable in a command prompt to include the bin directory of the QGIS installation...
Create the .exe using PyInstaller with the .spec file...