Setting Up Python on Microsoft Windows

How to set up Python on Microsoft Windows.

Installing Python on Windows

First, download the latest version of Python from the official Website. Choose the Windows x86-64 executable installer for the latest version of Python 3, unless you know that you need a different option.

Run the installer, and select the option to Add Python to PATH, so that you do not need to type the full path for Python commands. If prompted, choose the option to remove the path length limitation from Windows.

Python includes a complete copy of the official documentation, including the language reference and tutorials. To read the documentation, select the Manuals item in the Python folder on your Start menu.

Enabling Python in the Git Bash Shell

Git for Windows includes a UNIX shell. This is the same Bash shell that is standard on macOS and Linux. It also includes some of the same tools, such as ssh and the nano text editor.

To run Python inside this shell:

  1. Start Git Bash
  2. Type this command: nano ~/.bash_profile
  3. Write the lines shown below in the window
  4. Use Ctrl-X to save and exit the editor
  5. Type exit to close the Git Bash window

The next time that you open Git Bash, the python command will work as expected.

The Bash profile must include these lines:

alias python="winpty python"
alias pip="winpty pip"

Setting up for Software Development

This article explains the next steps for working with Python.