Windows/Python

From Omnia
Jump to navigation Jump to search

3.9.1 Installer

https://www.python.org/ftp/python/3.9.1/python-3.9.1-amd64.exe
python-3.9.1-amd64.exe  /?

For full list of options: https://docs.python.org/3.9/using/windows.html

/quiet = To completely hide the installer UI and install Python silently, pass the /quiet option.
/passive = To skip past the user interaction but still display progress and errors, pass the /passive option.
/uninstall = 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."

  • InstallAllUsers - Perform a system-wide installation. (default 0)
  • PrependPath - Add install and Scripts directories to PATH and .PY to PATHEXT (default 0)
  • Include_test - Install standard library test suite (default 1)
  • ...

For example, to silently install a default, system-wide Python installation, you could use the following command (from an elevated command prompt):

python-3.9.1-amd64.exe /quiet InstallAllUsers=1 PrependPath=1 Include_test=0

This will install to:

C:\Program Files\Python39\python.exe
python-3.9.1-amd64.exe /quiet InstallAllUsers=1 PrependPath=1 Include_test=0 TargetDir=C:\Python39

Make python3.exe work:

copy C:\Python39\python.exe C:\Python39\python3.exe

Delete this:

%USERPROFILE%\AppData\Local\Microsoft\WindowsApps\python3.exe
del "C:\Users\user\AppData\Local\Microsoft\WindowsApps\python3.exe"

3.8.7 Installer

https://www.python.org/ftp/python/3.8.7/python-3.8.7-amd64.exe

For full list of options: https://docs.python.org/3.8/using/windows.html

Python 2 Pip 21 Breakage

fix_pip.bat:

@echo off

C:\python27\python.exe -m pip --version
IF ERRORLEVEL 1 GOTO ERROR
echo Pip is happy
exit 0

:ERROR
echo Pip is broken, reinstalling...

curl https://bootstrap.pypa.io/2.7/get-pip.py -o get-pip.py
C:\python27\python.exe get-pip.py

C:\python27\python.exe -m pip --version

keywords