This is an opinionated approach to installing Python obtained from Python.org on Windows. Essentially, install per-user and keep Python out of the system or PATH environment variable. I’ll show you how to create some simple shortcuts to create Python console windows with your installed Python so you can easily used Python from the command line.
If you install Python on a Windows server used for something like builds or Flask websites and add Python to the PATH, you will quickly get stuck on a stale, aging, old Python version that can’t be updated because you (and everyone else) will be to busy and scared to worry about breaking existing apps on the machine.
Download and Run Setup
From the Python.org official Python site, then select Windows to view all download for Windows. Find the version you want, making sure you select a 64 bit version if that is what you want for a 64 bit machine.
Download the executable or web based installer for the version and bitness you want. For this example, the 64 bit 3.7.1 windows executable installer was used.
Running the install should show the following dialog:
Make sure that Install launcher for all users (recommended) and Add Python 3.7 to PATH are both unchecked.
Click Customize Installation to get the next dialog shown below:
Make sure py launcher and for all users (requires elevation) are both unchecked.
Click Next to get the Advanced Options dialog.
Make sure that Install for all users and Customize install location are clear, and additionally, Associate files with Python (requires the py launcher) is unchecked and disabled.
Click Install to run the install.
Create Command Shortcut
I created a batch file, py37_env.cmd with the following contents.
@echo off TITLE Python.org 3.7 REM add Python executable to PATH set python_base=%LOCALAPPDATA%\Programs\Python\Python37 REM add Python executable and tools like pip.exe to PATH set PATH=%PATH%;%python_base%;%python_base%\Scripts REM switch to Unicode code page chcp 65001
I then create a shortcut to the batch file with the following for the shortcut properties:
Assuming the batch file is in %USERPROFILE%\Desktop\Toolbox I create a short cut with the following for Target:
%comspec% /K "%USERPROFILE%\Desktop\Toolbox\py37_env.cmd"
And for Start In: someting like