Videos
» pip install python-msi
Apparently casual Python installer since 3.5 has the MSIs I require embeded and they won't come out. There's however the web-installer for each Python and with that one you can do the same thing and get a working Python installation:
python-3.5.0-webinstall.exe /layout <folder>
This downloads the Release MSIs files (not Debug or PDB only). Then you'll need to filter the files that have _d.msi and _pdb.msi suffix, which is trivial with Batch now and you end up with this structure:
core.msi
dev.msi
doc.msi
exe.msi
launcher.msi
lib.msi
path.msi
pip.msi
python-3.6.0-webinstall.exe
tcltk.msi
test.msi
tools.msi
and quite a lot of VS redistributables. Depending on your needs you may want to delete .exe, .msu(redists), _d.msi, _pdb.msi files in your working directory. The rest are Release files and files that extend the interpreter functionality such as launcher(py.exe), path(probably just permanently puts python to PATH), etc.
If you run each of them with this:
msiexec.exe /a <file> targetdir=<folder>
you get a working portable Python installation. Note that such thing is not officially supported.
A sub-folder now contain all the .msi files:
https://www.python.org/ftp/python/3.8.0/amd64/
Pyinstaller does not intergrate such a tool.
You could get a third party installer (some suggested here How to create a robust, minimal installer for Windows?) and add your output exe to it and install that way, if you choose the right tool you will be able to add to desktop (plus a lot of other actions such as adding to path ect).
Or you could use cx_Freeze which has it built in. When running the setup script just add the bdist_msi flag.
It can add to shortcut desktop but is fairly limited in other ways (or you may need to perform some hack).
To add to desktop with cx_Freeze see Use cx-freeze to create an msi that adds a shortcut to the desktop.
You can use Inno which creates a shortcut on the desktop and start menu. Also, it is located in the program directory of windows. it means that you can install/uninstall it like other programs or applications.
Inno website: https://www.jrsoftware.org/isinfo.php
A tutorial on how to use it on youtube: https://www.youtube.com/watch?v=DTQ-atboQiI
simple use. No transforms provided, and code is non-blocking:
import os
os.system('msiexec /i %s /qn' % msi_location)
With transforms, and code is non-blocking:
import os
os.system('msiexec /i %s TRANSFORMS=%s /qn' % (msi_location, transforms_location)
With transforms, and code is blocking - so you know when it has completed:
import subprocess
subprocess.call('msiexec /i %s TRANSFORMS=%s /qn' % (msi_location, transforms_location), shell=True)
For more info on TRANSFORMS: https://msdn.microsoft.com/en-us/library/aa367447%28v=vs.85%29.aspx
This is not really a python question, and it depends if your specific MSI package allow unattended installation. See this SO article
detect msi parameters for unattended install
how to find out about the parameters of an MSI package. Then, try the unattended installation manually using the windows command shell, calling msiexec. See here
http://technet.microsoft.com/en-us/library/cc759262%28v=ws.10%29.aspx
for more information.
Finally, all you need to do in python is to use os.system to call msiexec with the name of the package and the correct parameters.