Installing Python 3 on Windows

What You Need for This Project

Downloading and Installing Python

In a Web browser, go to https://www.python.org/downloads/

Ignore the yellow "Download Python" button, as shown below. It's just there to torture you.

Instead, click the Windows link below it.

If you are using 64-bit Windows, which most people are, download the "Windows x86-64 executable installer", as shown below. If you are using 32-bit Windows, use the 32-bit installer.

Run the installer. Install Python 3 with the default options.

Testing the Python Installation

Open a Command Prompt window and execute this command.
python3
It is very unlikely to work, because the Python community is unrelentingly hostile to Microsoft, and refuses to obey Windows standards.

The first problem is that python3 is not found, as shown below.

To fix this problem, we need to add a shortcut to help Windows find the installed Python executable.

Finding the Executable

Click the Start button.

In the Python section, find the Python 3 executable link, right-click it, point to More, and click "Open File Location", as shown below.

A windows opens showing a shortcut to Python 3, highlighted in gray in the image below.

Right-click that shortcut and click Properties.

In the Properties sheet, right-click the Target path and click Copy, as shown below.

Click Start. Type CMD. Right-click "Command Prompt" and click "Run as Administrator". If a User Account Control box appears, approve the action.

In the Administrator Command Prompt window, use the path you copied to construct a command like the one below. You may have to adjust this command to match the correct location of Python on your system.

mklink /H C:\Windows\python3.exe "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\python.exe"
After executing that command, try this one again:
python3
On my system, I got a "Missing DLL" error, as shown below.

I executed this command to fix that error. Again, you may need to adjust it for your system.

copy "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\python37.dll" c:\Windows\System
After executing that command, try this one again:
python3
Now Python 3 works, as shown below!

Execute this command to exit the interactive Python3 prompt:

exit()

Creating a Python Program

In a Command Prompt window, execute this command, as shown below.
notepad hello.py
A box pops up asking "Do you want to create a new file?". Click Yes.

In Notepad, enter this code, as shown below.

print("Hello, World")

In Notepad, click File, Save to save the file.

Running the Python Program

In the Command Prompt, execute this command, as shown below.
python3 hello.py
The program runs, printing out "Hello, World!", as shown below.


Posted 6-29-2020 by Sam Bowne