Installing Python on Windows
This segment will guide you through the process of installing Python on your Windows machine. We'll focus on a straightforward installation and, most importantly, ensure Python is accessible from your command line.
Downloading the Python Installer
First, you'll need to download the Python installer. Head over to the official Python downloads page: https://www.python.org/downloads/windows/. Choose the latest stable release of Python 3 (e.g., Python 3.12). Click the link for the Windows installer.
Running the Installer and Initial Setup
-
Locate the downloaded file: Find the
.exe
file you just downloaded (usually in your 'Downloads' folder) and double-click it to start the installation process. -
User Account Control (UAC): Windows may display a User Account Control prompt asking if you want to allow the app to make changes to your device. Click "Yes" to continue.
-
Installation Options: Install Now vs. Customize You'll see two options: "Install Now" and "Customize installation". For beginners, we strongly recommend choosing "Install Now". This will install Python with the most common settings. The "Customize installation" option allows for more control, but it's best left for more experienced users.
The Crucial 'Add Python to PATH' Checkbox
This is the most important step! On the first screen of the "Install Now" process, make sure to check the box labeled "Add Python 3.x to PATH" (where 3.x is the version number you downloaded).
What is the PATH environment variable?
Think of the PATH as a list of locations where your operating system looks for executable files (like python.exe
). When you type python
in the command prompt, Windows searches these locations to find the Python interpreter. If Python isn't in the PATH, Windows won't know how to run it.
Adding Python to the PATH allows you to run Python from any directory in your command prompt or terminal without specifying the full path to the Python executable.
Completing the Installation
-
Click "Install Now": With the "Add Python to PATH" checkbox checked, click the "Install Now" button.
-
UAC Prompt (Again): You may encounter another UAC prompt. Click "Yes" to allow the installation to proceed.
-
Installation Progress: The installer will now copy files and configure Python on your system.
-
Disable path length limit: After installation completes, you may see an option to "Disable path length limit". It's generally a good idea to click this and allow the change. This prevents potential issues with long file paths in Python projects.
-
Installation Complete: Once the installation is finished, you'll see a "Setup was successful" message. Click "Close".
Verifying the Installation
Now, let's verify that Python has been installed correctly and is accessible from the command line.
-
Open Command Prompt: Press the Windows key, type
cmd
, and press Enter to open the Command Prompt. -
Check Python Version: Type the following command and press Enter:
python --version
If Python is installed correctly and added to the PATH, you should see the Python version number displayed (e.g.,
Python 3.12.1
). -
Check pip Version:
pip
is the package installer for Python. Verify it's installed by typing:pip --version
You should see the pip version number.
If you see the version numbers for both python
and pip
, congratulations! You have successfully installed Python on your Windows machine. If you receive an error message like "'python' is not recognized...", double-check that you selected the "Add Python to PATH" option during installation. If you did, try restarting your computer and then repeating the verification steps. For more troubleshooting, refer to the official Python documentation: https://docs.python.org/3/using/windows/
Expected Outcome for this step:
User will successfully install Python on Windows, understand the importance of the PATH variable, and verify the installation.
No comments on this specific step yet. Be the first!
(Form to add comment for this step coming soon)