Installing & Launching

At first this page may seem overkill as reader of these pages are assumed to know python already, but there are things that can be wrong with an installation and having notes on exactly how things work can be a useful resource for when there are problems.

Python on Windows

Installing Python.

Python has an automated installer. Download and run the installer. Simple. But… install where?

Most programs install under C:\Program Files\ this location introduces a complication with Python.

The complication is that is an ‘administrator’ level folder and requires administrator privileges for any further installs, which can complicate life for future ‘pip installs’. The installer suggests installing in the appdata for the user who does the installing, even if the install is for all users.

This works, but i find the path a little long and create my own c:\Pythons folder and place installs there. The ‘python launcher‘ installs in the \Windows folder. While the install screen seems to suggest the launcher is only needed for multiple users, that is misleading and it is recommended to install the launcher even there is only one user of the computer.

Launching Python Itself.

To launching python at shell level, simply type python provides the python folder is on the path. The first version of python on the path will launch. The py command will also work if the launcher is also installed.

Launching Python Files.

If Python is correctly installed with ‘python launcher’, Python ‘.py’ files can be used in the same manner as ‘.exe’ files. Enter the file name (even without extension) and the code will run, automatically selecting the most appropriate python version from those installed.

If this is not working, there are a few things to check.

At ‘cmd’ the ‘assoc’ command lists all the windows file associations, with those ususally installed for Python listed here..


Is the list I have, and these should not be installation dependant. The ‘.py’ entry is the main one.

For each association, there can be an ‘ftype’ entry. For python, provided python launcher is installed, this will normally be

Python.File="C:\windows\py.exe" "%L" %*

The setting can be checked by ftype Python.File at the command prompt, and set by

ftype Python.File="C:\windows\py.exe" "%L" %*

Again, the setting should not be installation dependant, as py.exe should always be in the windows folder. If py.exe is not installed, the simplest remedy i have found would be to re-run the python installer.

The next link in the chain for launching python files is the configuration for py.exe

If py.exe cannot find python installations then the error “Can’t find a default Python”.

If this occurs, then py.exe can be debuged by setting the relevant environment variable.


One solution is to ensure the following registry entry (for the installed version) is set to the folder where the relevant python is installed.


Py.ini Files.

More settings can be controlled by Py.ini files. As can be seen when launching using the launcher, there are two possible files, on in the windows folder, and one in the AppData\Local folder, as listed on the debut output.

The format of the py.ini file is as follows:

; Note: ini files regard lines beginning with a ; as comments
; the 'defaults' section follows
; To have Python 3 as default, use this line

; now the commands section
; 'shebang' strings (see link below) are matched to commands
; commands can be for a python version, or any other shebang chosen
;  even not python at all
; For example use  #! sample
; and then add a sample= command. 
python="c:\Program Files\Sample.exe" -option

This is as far as the research on these files goes at this time, but I plan to add to this section over time.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s