4

In versions lower than 3.5.0 there was a .MSI installer for Windows, which had a really nice hidden option. That option looked like this:

msiexec.exe /a "file.msi" /qb /L*V "file.log" ALLUSERS=0 TARGETDIR="target" CURRENTDIRECTORY="%~dp0" <additional options>

which basically allows me to ignore admin rights, because the MSI turns to some kind of installer for whole network, thus the permission workaround.

With Python 3.5.0 was introduced a new .EXE installer, which has .MSI files packed in itself, you can get them out with:

python-3.5.0.exe /layout [optional target directory]

yet there's a really annoying thing going around with this solution. When I do this, the .MSI files have a -d.msi suffix and when I manually unpack it with the msiexec command above, every file has that suffix too, which makes it a completely damaged installation. Renaming the files isn't really an option as each file has -d.<file ext>, not -d.msi.<file ext> suffix, so it's too hard to rename it in a simple way with tools such as Batch, unless I want to check for multiple cases (e.g. folders).

Is there any way how to extract the content of the installer to a separate folder, like it was possible before without any additional stuff put into Programs and features, such as Python 3.5.0 (64bit) or simlar?

Or other question - is there any way how to forbid the installer to access Programs and features, shut it from asking admin privileges and registry at all?

It's quite useful if I want to have multiple python installations not bound to anything at all with testing as its main purpose. Note, that I have no intention to use python launcher (that py.exe thing), virtualenv or any other alternative "solution" as every of them allows me to install only a single Python installation of the same version and/or is too big for quick usage.

3 Answers 3

4

A sub-folder now contain all the .msi files: https://www.python.org/ftp/python/3.8.0/amd64/

3

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.

1

As mentioned in the previously linked bug report, the nuget packages are more suitable for unpacking manually - they're actually zip files.

The Python 3.8.1 nuget contains a tools subfolder which contains the actual Python installation (with a normal python.exe, pythonw.exe, Lib/, include/ etc); things outside that folder are metadata.

1
  • that works. but one problem: how to add tkinter? I have search the solution for embedded python, which copies files from another installation from official python. What I do not wanna to install? because if I have installed one there is no need to use a zipped one.
    – oyster
    Oct 9, 2022 at 5:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .