How to Install Python on Windows

If you want to start programming in Python on your Windows PC, you'll need to download and install a version of Python. This wikiHow teaches you how to install Python (2 or 3) using the official Windows installer, as well as how to fix the...

Method 1 of 3:

Installing Python 3

  1. Picture 1 of How to Install Python on Windows
    Go to https://www.python.org/downloads. The most recent version of Python will always appear on the "Download" button near the top of the page.
    1. If you want to use Python 2, see the "Installing Python 2" method.
  2. Picture 2 of How to Install Python on Windows
    Click Download Python . If this does not start the download immediately, click Save on the pop-up window to start it.
    1. Python 3.7 and newer will run on any Windows operating system except Windows XP. If you need to install Python 3 on XP, scroll down and click Download next to the most recently-updated version of Python 3.4.[1]
  3. Picture 3 of How to Install Python on Windows
    Run the installer. You can do so by double-clicking python-.exe in your Downloads folder.
  4. Picture 4 of How to Install Python on Windows
    Check the box next to "Add Python to PATH." It's at the bottom of the window.
    1. If you don't see this option, you'll need to complete this method after you finish installing Python.
  5. Picture 5 of How to Install Python on Windows
    Click Customize installation. It's the second blue link on the window.
  6. Picture 6 of How to Install Python on Windows
    Review the installation options and click Next. All of Python's features are selected by default. Unless you have a specific need to skip installing any part of this package, just leave these settings alone.
  7. Picture 7 of How to Install Python on Windows
    Check the box next to "Install for all users." If you're a system administrator, this option ensures that other users on this computer are able to use Python. This also changes the installation location to the Program Files(x86)Python(version) instead of your personal library.
    1. If you didn't have the option to select "Add Python to PATH" earlier, make note of the installation directory that appears here. You'll need to add it to your system variables after installing.
    2. If you don't want anyone else on the computer to be able to use Python, you can leave the box unchecked.
  8. Picture 8 of How to Install Python on Windows
    Click Install. It's at the bottom of the window.
  9. Picture 9 of How to Install Python on Windows
    Click Yes to confirm. This installs Python on your PC. Once the installation is complete, you'll see a "Setup was successful" window—don't close it just yet.
  10. Picture 10 of How to Install Python on Windows
    Click Disable path length limit. It's toward the bottom of the "Setup was successful" window. This final step ensures that Python (and other apps) to use paths more than 260 characters in length.
  11. Picture 11 of How to Install Python on Windows
    Click Yes to confirm. Python is now installed and ready to use.
  12. Picture 12 of How to Install Python on Windows
    Click Close to exit the installer.
  13. Picture 13 of How to Install Python on Windows
    Test your Python installation. Here's how to make sure the path is set up properly:
    1. Type cmd into the Windows search bar and press Enter.
    2. Type python and press Enter. You should see >>> at the beginning of the current line. This means Python is working and the path is set correctly.
    3. If you see an error that says "python is not recognized as an internal or external command," see the "Adding the Python Path to Windows" method.
    4. Type exit() to return to the command prompt.
Method 2 of 3:

Installing Python 2

  1. Picture 14 of How to Install Python on Windows
    Go to https://www.python.org/downloads in a web browser. Use this method if you want to write code in Python 2 instead of (or in addition to) Python 3 in Windows.
  2. Picture 15 of How to Install Python on Windows
    Scroll down and click a Python 2 version. The versions appear under the "Looking for a specific release?" header.
    1. If you don't know which version of Python 2 to install, just click the first version beginning with "2." In the list. This ensures you're using the most recently-updated version.
  3. Picture 16 of How to Install Python on Windows
    Scroll down and select an installer. This downloads the installer to your computer, though you may have to click Save to start the download.
    1. If you have a 64-bit computer, select Windows x86-64 MSI installer.
    2. If you're using a 32-bit computer, select Windows x86 MSI installer.
  4. Picture 17 of How to Install Python on Windows
    Run the Python installer. You can do this by double-clicking python-(version).msi in your Downloads folder.
  5. Picture 18 of How to Install Python on Windows
    Select an option for installing. If you want other users of this PC to be able to use Python, select Install for all users. If not, select Install for just me.
  6. Picture 19 of How to Install Python on Windows
    Click Next. It's at the bottom-right corner.
  7. Picture 20 of How to Install Python on Windows
    Select an install directory (optional). The default directory is fine for most people, but you can change it if you wish by selecting a different folder from the menu.
  8. Picture 21 of How to Install Python on Windows
    Click Next.
  9. Picture 22 of How to Install Python on Windows
    Scroll down to the bottom of the "Customize Python" features list. You should see an option called "Add python.exe to Path." It probably has an "X" on its corresponding button.
    1. If you don't see this option, see this method after installing Python.
  10. Picture 23 of How to Install Python on Windows
    Click the X button next to "Add python.exe to Path." A menu will expand.
  11. Picture 24 of How to Install Python on Windows
    Click Will be installed on local hard drive. This ensures that you can run Python commands from anywhere without having to type the full path to Python.
  12. Picture 25 of How to Install Python on Windows
    Click Next. A security pop-up will appear on most systems at this point.
  13. Picture 26 of How to Install Python on Windows
    Click Yes to continue. This installs Python 2 on the PC. In a few moments, you'll see a window that says "Complete the Python Installer."
  14. Picture 27 of How to Install Python on Windows
    Click Finish on the installer. Python is now installed.
  15. Picture 28 of How to Install Python on Windows
    Test your Python installation. Here's how to make sure the path is set up properly:
    1. Type cmd into the Windows search bar and press Enter.
    2. Type python and press Enter. You should see >>> at the beginning of the current line. This means Python is working and the path is set correctly.
    3. If you see an error that says "python is not recognized as an internal or external command," see the "Adding the Python Path to Windows" method.
    4. Type exit() to return to the command prompt.
Method 3 of 3:

Adding the Python Path to Windows

  1. Picture 29 of How to Install Python on Windows
    Press Win+R to open the Run dialog. Use this method if you're installing an older version or see the "python is not recognized as an internal or external command" error when trying to use Python.
  2. Picture 30 of How to Install Python on Windows
    Type sysdm.cpl and click OK. This opens the System Properties dialog.
  3. Picture 31 of How to Install Python on Windows
    Click the Advanced tab. It's at the top of the window.
  4. Picture 32 of How to Install Python on Windows
    Click Evironment Variables. It's near the bottom of the window.
  5. Picture 33 of How to Install Python on Windows
    Select the Path variable under "System variables." This is in second group of variables (not the "User variables" group on top).
  6. Picture 34 of How to Install Python on Windows
    Click Edit. It's at the bottom of the window.
  7. Picture 35 of How to Install Python on Windows
    Edit the variables on Windows Vista and earlier. If you're using Windows 10, 8, or 7, skip to the next step. If you're using XP or Vista:
    1. Click inside the "Variable value" box to deselect the selected text.
    2. Scroll all the way to the end of the text that's already in the "Variable value" box.
    3. Type a semicolon ; at the end of the text (no spaces).
    4. Type the full path to Python (e.g., C:Python27) right after the semicolon.
    5. Type a semicolon ; at the end of what you just typed (no spaces).
    6. Type the full path again, but add Scripts to the end. Example: C:Python27Scripts;C:Python27Scripts.
    7. Click OK until you've closed all windows, and then restart your PC. No need to continue with this method.[2]
  8. Picture 36 of How to Install Python on Windows
    Click New. It's the first button near the top-right corner of the window.
  9. Picture 37 of How to Install Python on Windows
    Enter the full path to Python. For example, if Python installed to C:Python27, type that into the field.
  10. Picture 38 of How to Install Python on Windows
    Press Enter. Now you'll have to enter just one more path.
  11. Picture 39 of How to Install Python on Windows
    Click New again.
  12. Picture 40 of How to Install Python on Windows
    Enter the full path to the Python "Scripts" directory. This is the same path as you typed before, except you'll be adding Scripts to the end.
    1. For example, C:Python27Scripts.
  13. Picture 41 of How to Install Python on Windows
    Press Enter. Your new variables are saved.
  14. Picture 42 of How to Install Python on Windows
    Click OK and then OK again. You should now be able to run Python from the command line just by typing python.
Update 04 March 2020
Category

System

Mac OS X

Hardware

Game

Tech info

Technology

Science

Life

Application

Electric

Program

Mobile