简体   繁体   中英

Python GTK+ 3 Application Installer and Executable on Windows

I recently finished an application using GTK, which I installed on windows with MSYS2 and MINGW64. So far, I have only been able to run the app from the MSYS2 command line; however, I am at the stage where I need to deploy the application (build an installer and executable file).

Here are the routes I have taken from msys2 so far:

  1. py2exe from msys2 with the mingw64's python3.6 (with GCC 7.3.0 64 bit). I can build the setup file just fine, but, when I run from msys2 python3 setup.py py2exe , I get the dreaded IndexError: tuple index out of range . After some research, I've learned that I get this because py2exe does not as of yet support python > 3.4

    1. pinstaller: from the msys2 terminal, I cannot even unpack this option. I get this error code distutils.errors.DistutilsPlatformError: VC 6.0 is not supported by this module .

Here is a route I have taken out of msys2, in my Windows cmd:

  1. cx_Freeze: Pip could not grab this file from the msys2 terminal, so I moved my project to folders in windows and adjusted my setup.py to find all of the dlls and other necessary files. In terms of actually running and generating an installer exe and application exe, I have had the most success with this option. After running the generated msi file and then running the new executable, though, I get an error like this: from _gi: cannot load the specified dll . After doing some hacky troubleshooting (providing other dlls and reading through the _gi.pyd I provided). Here's what I (believe) I learned. The _gi.pyd specifies python dlls and visual c runtime dlls to include with the import statements import gi catalyzes ( import _gi; from . import _.gi; etc. ). These specify dlls the msys2 environment of my project uses, so I added them to my setup.py. After doing this, I got an error noting that my app requires a python3.dll that was conflicting with another python dll (the one I tried to provide).

Here is what I think I know, and please, someone, tell me I'm wrong so that I don't have to rebuild my application with pyQt5 (which actually does work without msys2 and mingw64):

I need to figure out a way to provide only the python and c dlls that mingw64 uses (ie not the python3.dll that the command python setup.py bdist_msi seems to automatically include and unpack from my installer) and bundle those with my application.

OR I need to figure out a way to install a different python 3 (python 3.4) into my mingw64 path in order to use py2exe (which does install in that environment). Even then, though, I would have to figure out how to also give this path an appropriate msvc dll in order for the application to still work.

OR OR I need to rebuild my app.

Has anyone been successful in developing a windows installer and executable with these specs (msys2, mingw64, GTK+ 3, and mingw64's python3.6.5 and GCC 7.3.0 64 bit)? Is there a way to make any of the above-mentioned methods for doing this work in the msys2 terminal? Is there a way to make these work in windows cmd (where I can actually get cx_Freeze and py2exe to work)? Are there any options I'm missing?

Apologies for the long post.

Distribute GTK3 Applications made in Python with reduced MSYS2

Here is an alternative solution to distribute GTK+3 applications written in Python with updated MSYS2 packages, doesn't create an executable though, sorry.

It copies just the needed files for your python script (as long as they are in MSYS2 folder, including gtk and python modules) to a dist folder wich you can copy to another Windows machine. I've made tests and the output is around 51 MB of size for my case.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM