Tuesday, 19 November 2024

Use Pyinstaller inside Wine

 Pyinstaller is a tidy tool that will take your python code and wrap it with its dependencies and libraries into a single application file.

The trouble is that if you run it on Linux it will create a Linux app.  

If you want it to create a Windows .exe app, you must run Pyinstaller in a Windows environment.

So, we use Wine, which recreates a Windows environment within a Linux terminal.

As an example, I have a Python app sitting in a folder in my home directory, and I want to create a Windows .exe app for a client.  I have already installed Wine.

Steps:

1.    Ctrl-Alt-T to open a terminal window

2.    The command:  $ wine pyinstaller.exe --onefile /home/joel/Python_Programs/CARAT.py

wine                    starts the wine environment

pyinstaller.exe    runs the pyinstaller program within Python, within wine

--onefile              bundles the executable into one file

rest is the location of the .py file that is to be bundled.

Pyinstaller creates a couple of new folders within the home folder, and the .exe fill sits within the Dist folder:



 

 

       

No comments:

Post a Comment

Using Python to Write a Dataframe to a Google Spreadsheet

 I had all sort of issues with this one.  Multiple searches, and trying many variations of the Google API access code modules to find one th...