How to make a cross platform python app with pyinstaller??

Michael Torrie torriem at gmail.com
Tue Feb 4 23:27:59 EST 2020


On 2/4/20 8:33 PM, Chris Angelico wrote:
> On Wed, Feb 5, 2020 at 2:32 PM Souvik Dutta <souvik.viksou at gmail.com> wrote:
>>
>> Hi,
>> I made a python gui with pyqt5 and packed it with pyinstaller. It is
>> running well in my computer but when I gave it to a friend who doesn't have
>> any python version installed and it didn't run. The message was "This app
>> cannot be run on your pc.". How can I solve this???
> 
> Distribute the .py file instead. It can then run on any computer with
> Python installed.

And PyQt5 installed of course.  And Qt5.  None of which is likely to be
a commonly installed software package.  Asking someone to install Python
separately to run your app is a tall order, to say nothing of PyQt5.  So
while this answer is technically correct, the larger issue of
distributing Python programs remains.

Furthering Chris's answer a bit, there really is no way to simply
distribute a Python app and all its dependencies in any simple, portable
way.  If the dependencies already exist on the target system, then Chris
is absolutely right. You just give him the py file and he double-clicks
on it and it runs.  That may work some of the time.

The reality is that this is often insufficient.  Your best bet may be to
build an installer that either installs everything you need into a
Program Files directory, or also runs the Python, and PyQt5 installers
to install them system-wide before installing your app and your bundled
shortcuts and program launcher.  Building installers isn't too awful
using a number of free tools, but it's an entire programming domain in
and of itself.


More information about the Python-list mailing list