[PyQt] Porting PyQt GUI between platforms.
Juan Manuel Santos
vicariousdm at gmail.com
Thu Aug 5 01:57:25 BST 2010
From: Algis Kabaila <akabaila at pcug.org.au>
To: pyqt at riverbankcomputing.com, gmail at henning-schroeder.de
Date: Wednesday 04 August 2010
> Haerzlichen Dank! Many thanks for writing!
>
> I am somewhat confused and I think it is because of my poor communication
> skills (sad to admit, as my life had been dedicated to communicating...).
> Perhaps the problem of porting OSS Python program from Linux to windows
> platform should be re-stated in two parts:
>
> 1. [Prepare the program for win platform] Run the OSS Python program on MS
> Windows platform.
>
> 2. [Package the program]. Package the OSS Python program and its
> dependencies in a package that can easily be given to a windows user for
> installation in his/her computer.
>
> As Juan Manuel Santos so rightly suggested, part (1) of the porting often
> means simply running the Python program on windows! (Spectacular, when it
> works!). If modifications of the program are necessary (to enable the
> program to run under windows), that can be done by several methods: a) On
> a "box" with a windows Platform b) Virtual Machine with a windows platform
> installed c)Wine.
>
> For my current small script, (1) turns out to be very simple and easy.
>
> Part 2 is not so obvious. PyInstaller documentation suggests (to me, at
> least) that it is convenient to compile the PyInstaller under Linux. This
> further suggests that the packaging should probably be done whilst on a
> Linux platform.
>
> Am I sadly mistaken? Should the packaging be done on the windows (viz Win
> XP) platform, and thus PyInstaller compiled whilst on a windows platform?
>
> It probably is clear to all how one should go about this process and it may
> be better not to clutter this busy list any more, so off list email would
> be much appreciated. OTH, I do not mind to publicly admit that I am
> confused, as long as it is not too boring to all and might be useful to
> some.
I hope I am not offending the list by continuing this thread, but often I found
that these type of procedures (packaging a Python program for another OS,
namely Windows) have very few or poor documentation on the Internet. So
perhaps, maybe for the record it's good that these subject is discussed here.
Algis, in order to package a PyQt (or any Python program for that matter) to
run on Windows with no dependencies (i.e. convert the .py script into a .exe
binary which does not need the Python interpreter to run), you first need a
complete Windows environment in which to run your application (in source
form). PyInstaller works (or at least I believe it works like this, given my
assumptions) by checking which libraries does the program need, and linking
them appropriately when making the executable binary.
In your particular case, should you choose not to install the complete
dependencies for the program in source form in your grandson's computer, then
you'd need to turn the Python program into an .exe binary. To do this you need
first said environment (which could be anything from a real native Windows
installation, a VM with Windows installed or even Wine as has been said). It
is in this environment in which you should install PyInstaller (ergo, you'd
need PyInstaller for Windows) and where you should run the PyInstaller related
steps.
Think about it this way: PyInstaller on Linux has no way to know how to
execute your application on Windows :)
Hope these comments were useful.
Cheers,
Juan Manuel
More information about the PyQt
mailing list