Python exe silent install

Python Silent Installs

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

“%CD%\python-3.5.1.exe” /quiet InstallAllUsers=1 PrependPath=1 Include_test=0 TargetDir=c:\Python351

“%CD%\python-3.7.0.exe” /quiet InstallAllUsers=1 PrependPath=1 Include_test=0

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)
Читайте также:  Deleting MySQL Table record

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."

Источник

lboulard / .gitattributes

This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters

* .bat eol = crlf
* .xml eol = crlf

Silent installation of Python

Made for multiple installation of python on same machine.

Works and tested with Python 3.5 to 3.8.

Copy all dosbatch and xml files next to installer named like Python-3.x.y-amd64.exe .

Configure default python for script launch

For default python, as administrator, run unattend-default.bat to create file unattend.xml needed for silent installation.

For all other python installations, as administrator, run unattend-not-default.bat to create file unattend.xml needed for silent installation.

See Caveats if you need to change default python version on already configured computer.

For each python that needs to be installed, run python-silent-install.bat .

For each python that needs to be removed from computer, run python-silent-install.bat .

Full offline installation

Use download-debug.bat to fetch all installation medias including debug files and symbols.

Changing a non-default installation to become default installation does not work when minor version is not changed. Installers seems to ignore new settings on existing installation. Issue observed when going from version 3.6 to existing version 3.7.

  • To change default python version from 3.N to 3.N+1 :
    • version 3.N must be uninstalled first
    • version 3.N+1 must be uninstalled after
    • change unattend.xml of version 3.N to unattend-not-default.xml
    • change unattend.xml of version 3.N+1 to unattend-default.xml
    • install version 3.N , then version 3.N+1

    This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters

    @ SETLOCAL
    @ CD /D » %~dp0 «
    @ SET PYVER =
    @ FOR %% f IN ( » python-3.*-amd64.exe » ) DO @ SET » PYVER = %% ~nf «
    @ ECHO SET PYVER= %PYVER%
    @ IF NOT DEFINED PYVER (
    ECHO ** ERROR: No Python installation program found
    GOTO : EOF
    )
    » .\ %PYVER% .exe » /passive /layout » %PYVER% «

    This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters

    @ SETLOCAL
    @ CD /D » %~dp0 «
    @ SET PYVER =
    @ FOR %% f IN ( » python-3.*-amd64.exe » ) DO @ SET » PYVER = %% ~nf «
    @ ECHO SET PYVER= %PYVER%
    @ IF NOT DEFINED PYVER (
    ECHO ** ERROR: No Python installation program found
    GOTO : NagUser
    )
    @ IF NOT EXIST » %LOCALAPPDATA% \lboulard » MD » %LOCALAPPDATA% \lboulard «
    @ IF NOT EXIST » %LOCALAPPDATA% \lboulard\logs » MD » %LOCALAPPDATA% \lboulard\logs «
    @
    @ IF » %1 » == » uninstall » GOTO : Uninstall
    @ IF NOT EXIST » unattend.xml » (
    ECHO **ERROR: unattend.xml file is missing
    GOTO : NagUser
    )
    » %PYVER% .exe » ^
    /passive ^
    /log » %LOCALAPPDATA% \lboulard\logs\ %PYVER% -install.log «
    IF ERRORLEVEL 1 GOTO : NagUser
    @ GOTO : EOF
    @ :Uninstall
    » %PYVER% .exe » ^
    /uninstall ^
    /passive ^
    /log » %LOCALAPPDATA% \lboulard\logs\ %PYVER% -uninstall.log «
    @ IF ERRORLEVEL 1 GOTO : NagUser
    @ GOTO : EOF
    @
    @ :NagUser
    @ :: Pause if not interactive
    @ ECHO %cmdcmdline% | FIND /i » %~0 » > NUL
    @ IF NOT ERRORLEVEL 1 PAUSE

    This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters

    CALL » %~dp0 python-silent-install.bat » uninstall
    @ IF ERRORLEVEL 1 GOTO : NagUser
    @ GOTO : EOF
    @ :NagUser
    @ :: Pause if not interactive
    @ ECHO %cmdcmdline% | FIND /i » %~0 » > NUL
    @ IF NOT ERRORLEVEL 1 PAUSE

    This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters

    @ SETLOCAL
    @ CD » %~dp0 «
    @ IF EXIST unattend.xml DEL unattend.xml
    mklink unattend.xml unattend-defaultpy.xml
    @ IF NOT ERRORLEVEL 1 GOTO : EOF
    @ :NagUser
    @ :: Pause if not interactive
    @ ECHO %cmdcmdline% | FIND /i » %~0 » > NUL
    @ IF NOT ERRORLEVEL 1 PAUSE

    This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters

    This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters

    @ SETLOCAL
    @ CD » %~dp0 «
    @ IF EXIST unattend.xml DEL unattend.xml
    mklink unattend.xml unattend-not-defaultpy.xml
    @ IF NOT ERRORLEVEL 1 GOTO : EOF
    @ :NagUser
    @ :: Pause if not interactive
    @ ECHO %cmdcmdline% | FIND /i » %~0 » > NUL
    @ IF NOT ERRORLEVEL 1 PAUSE

    This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters

    Источник

    Python 3.9 Silent Install (How-To Guide)

    Python is an interpreted, high-level and general-purpose programming language. Python’s design philosophy emphasizes code readability with its notable use of significant whitespace. This article will serve as an informative guide and give you a clear understanding of how to perform a silent installation of Python 3.9 from the command line using the EXE installer.

    How to Install Python 3.9 Silently

    Python 3.9 (32-bit) Silent Install (EXE)

    1. Navigate to: https://www.python.org/ftp/python/
    2. Select the 3.9.x version of your choice
    3. Download the python-3.9.x.exe to a folder created at (C:\Downloads)
    4. Open an Elevated Command Prompt by Right-Clicking on Command Prompt and select Run as Administrator
    5. Navigate to the C:\Downloads folder
    6. Enter the following command:
      • python-3.9.x.exe /quiet InstallAllUsers=1 PrependPath=1
    7. Press Enter

    After a few moments you will find Python entries in the Start Menu, Installation Directory, and Programs and Features in the Control Panel.

    Python 3.9 (64-bit) Silent Install (EXE)

    1. Navigate to: https://www.python.org/ftp/python/
    2. Select the 3.9.x version of your choice
    3. Download the python-3.9.x-amd64.exe to a folder created at (C:\Downloads)
    4. Open an Elevated Command Prompt by Right-Clicking on Command Prompt and select Run as Administrator
    5. Navigate to the C:\Downloads folder
    6. Enter the following command:
      • python-3.9.x-amd64.exe /quiet InstallAllUsers=1 PrependPath=1
    7. Press Enter

    After a few moments you will find Python entries in the Start Menu, Installation Directory, and Programs and Features in the Control Panel.

    The information above provides a quick overview of the software title, vendor, silent install, and silent uninstall switches. The download links provided take you directly to the vendors website. Continue reading if you are interested in additional details and configurations.

    Additional Configurations

    Create an Installation Log File

    The Python 3.9 installer offers the option to generate a log file during installation to assist with troubleshooting should any problems arise. You can use the following command to create a verbose log file with details about the installation.

    Change Default Installation Directory

    You can change the default installation directory by using the following command line parameters. In this example, I’m installing Python 3.9 to “C:\Python39”

    Источник

Оцените статью