Thursday, September 1, 2016

Python: Installing on Windows

Python for Windows can be found at: Python Releases for Windows

Click on the the previous link reveals the following:


A 64-bit machine requiring Python 3.6 can download

  • Windows x86-64 web-based installer: small foot installer is downloaded and the components are pulled from the web during install. This approach requires an active Internet connection.
  • Windows x86-64 executable installer: a complete installer which when run can install Python without requiring a connection to the Internet. 

Invoking Windows x86-64 executable installer displays the following start screen:


The the bottom of the screen is a checkbox "Add Python 3.6 to PATH" which adds path required to execute the Python executable to the system PATH environment variable. Selecting this checkbox is as follows:


From the candidate install links select "Customize installation" which displays the following screen;


None of the options shown in the previous screenshot will adversely affect Windows or other development environments so they can be safely installed. Clicking on Next displays the following:


None of the Advanced Options shown in the previous screenshot will adversely affect Windows or other development environments so they can be safely selected.Notice below the the install location is in a locale accessible to all users. After selecting all Advanced Options the screen appears as follows:


Click on Install to being the installation of Python:


The previous screen is displayed while installation is in process. One installation is completed, the the following screen is displayed:



Once Python is installed the following are added to the environment variable PATH:
C:\Program Files\Python36\Scripts\;C:\Program Files\Python36\;

The PATHEXT is also updated include PY and PYW (see below):
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY;.PYW

By adding the PY and PYW extensions to PATHEXT, means that Windows will treat files with these extensions like executables. To understand this consider the following file, HelloWorld.PY displayed in Python's IDLE editor:


From the command-line it is possible simply run HelloWorld.py which executes because Python.exe is found in PATH, the PY extension is treated as an executable due to PATHEXT and the PY extension is mapped to the execution of the Python.exe command:




No comments :

Post a Comment