Jean-Marc Volle
Jean-Marc Volle

Reputation: 3333

python security update installation on windows

Python security updates are source only updates. There is no windows installer.
For instance the page for python 3.6.12 states:

Security fix releases are produced periodically as needed and are source-only releases; binary installers are not provided.

Could someone explain how I can update/patch a Python installation done by the windows installer, so that latest Python security fixes are applied: eg., going from ython 3.6.6 to Python 3.6.12

Or if not possible how to install from Python source code directly.

Upvotes: 21

Views: 12281

Answers (3)

adam.hendry
adam.hendry

Reputation: 5645

To install security patches after the last full bugfix release, you must build Python from source:

Compile the Binaries

  1. Install Visual Studio 2019 Community and select:
  • the Python development workload, and

  • the Python native development tools (this is under Optional, but is necessary in order to build python from source)

    Python development workload and native development tools

  1. Download the python source code and unzip it.

  2. Navigate to the folder and install required external dependencies by running PCbuild\get_externals.bat

  3. Build the debug (python_d.exe) and release (python.exe) binaries

> PCbuild\build.bat -p x64 -c Debug
> PCbuild\build.bat -p x64 -c Release

you can also build the Profile Guided Optimization (pgo) binary

> PCbuild\build.bat -p x64 --pgo

The binaries on python.org are run through PGO by default, so a --pgo binary will be faster than a -c Release binary. The debug binary is necessary for adding breakpoints and debugging your code.

All built binaries are placed in PCbuild\amd64.

Build the Installer

The instructions for building an installer are in Tools\msi\README.txt.

  1. Download the extra build dependencies by running Tools\msi\get_externals.bat

NOTE: This is done in addition to running PCbuild/get_externals.bat.

It installs additional binaries to externals\windows-installer that are needed for making installers. Specifically,

  • WiX (wix.exe), which is a toolset that lets developers create installers for Windows Installer, the Windows installation engine.
  • HTML Help (htmlhelp), which is for building documentation.
  1. Turn on .NET Framework 3.5 Features under Turn Windows features on or off

    .NET Framework 3.5 Features

NOTE: This is required by WiX.

  1. Build the installer by running
> .\Tools\msi\buildrelease.bat -x64

NOTE: Be sure the following environment variables are properly set or left blank so the script can set them:

PYTHON=<path to python.exe>
SPHINXBUILD=<path to sphinx-build.exe>

The installer will be placed in PCbuild\amd64\en-us. It is a single .exe (the installer entry point). The folder will also have a number of additional CAB and MSI files. Each MSI contains the logic required to install a component or feature of Python, but these should not be run directly.

Specify --pack to build an installer that does not require all MSIs to be available alongside. This takes longer, but is easier to share.

Upvotes: 15

Aleksandr Serov
Aleksandr Serov

Reputation: 71

I managed to install python of version 3.6.13 using conda
Just install python 3.6 in separate invironment:

conda create -n myenvironment python=3.6
conda activate myenvironment
python --vesion

Or point out specific version:

conda create -n myenvironment python=3.6.13

Check all available versions:

conda search python

Upvotes: 1

Vijay Jangir
Vijay Jangir

Reputation: 653

I'm not sure why you just don't install a newer version as you're on windows (3.8), but if you really have to do it from source, this link should help you.

https://docstore.mik.ua/orelly/other/python/0596001886_pythonian-chp-2-sect-1.html

Disclaimer: I've not tested it, but the process should work

Upvotes: -1

Related Questions