Depending on whether you download the MSI or EXE type, this is how you would silently install Python.
MSI
%windir%\system32\msiexec.exe /i “%CD%\python-2.7.11.msi” /qn /norestart
EXE
“%CD%\python-3.5.1.exe” /quiet InstallAllUsers=1 PrependPath=1 Include_test=0 TargetDir=c:\Python351
{updated}
“%CD%\python-3.7.0.exe” /quiet InstallAllUsers=1 PrependPath=1 Include_test=0
Notes
Packaging
I packaged to a deployable EXE using ExeScript. You can also use a self-extracting WinRar EXE.
All of the options available in the installer UI can also be specified from the command line, allowing scripted installers to replicate an installation on many machines without user interaction. These options may also be set without suppressing the UI in order to change some of the defaults.
To completely hide the installer UI and install Python silently, pass the /quiet option. To skip past the user interaction but still display progress and errors, pass the /passive option. The /uninstall option may be passed to immediately begin removing Python – no prompt will be displayed.
All other options are passed as name=value, where the value is usually 0 to disable a feature, 1 to enable a feature, or a path. The full list of available options is shown below.
Name | Description | Default |
---|---|---|
InstallAllUsers | Perform a system-wide installation. | 0 |
TargetDir | The installation directory | Selected based on InstallAllUsers |
DefaultAllUsersTargetDir | The default installation directory for all-user installs | %ProgramFiles%\Python X.Y or%ProgramFiles(x86)%\Python X.Y |
DefaultJustForMeTargetDir | The default install directory for just-for-me installs | %LocalAppData%\Programs\PythonXY or%LocalAppData%\Programs\PythonXY-32 |
DefaultCustomTargetDir | The default custom install directory displayed in the UI | (empty) |
AssociateFiles | Create file associations if the launcher is also installed. | 1 |
CompileAll | Compile all .py files to .pyc. | 0 |
PrependPath | Add install and Scripts directories tho PATH and .PY to PATHEXT | 0 |
Shortcuts | Create shortcuts for the interpreter, documentation and IDLE if installed. | 1 |
Include_doc | Install Python manual | 1 |
Include_debug | Install debug binaries | 0 |
Include_dev | Install developer headers and libraries | 1 |
Include_exe | Install python.exe and related files | 1 |
Include_launcher | Install Python Launcher for Windows. | 1 |
InstallLauncherAllUsers | Installs Python Launcher for Windows for all users. | 1 |
Include_lib | Install standard library and extension modules | 1 |
Include_pip | Install bundled pip and setuptools | 1 |
Include_symbols | Install debugging symbols (*.pdb) | 0 |
Include_tcltk | Install Tcl/Tk support and IDLE | 1 |
Include_test | Install standard library test suite | 1 |
Include_tools | Install utility scripts | 1 |
LauncherOnly | Only installs the launcher. This will override most other options. | 0 |
SimpleInstall | Disable most install UI | 0 |
SimpleInstallDescription | A custom message to display when the simplified install UI is used. | (empty) |
For example, to silently install a default, system-wide Python installation, you could use the following command (from an elevated command prompt):
python-3.5.0.exe /quiet InstallAllUsers=1 PrependPath=1 Include_test=0
To allow users to easily install a personal copy of Python without the test suite, you could provide a shortcut with the following command. This will display a simplified initial page and disallow customization:
python-3.5.0.exe InstallAllUsers=0 Include_launcher=0 Include_test=0 SimpleInstall=1 SimpleInstallDescription="Just for me, no test suite."