This article was co-authored by wikiHow staff writer, Nicole Levine, MFA. Nicole Levine is a Technology Writer and Editor for wikiHow. She has more than 20 years of experience creating technical documentation and leading support teams at major web hosting and software companies. Nicole also holds an MFA in Creative Writing from Portland State University and teaches composition, fiction-writing, and zine-making at various institutions.
The wikiHow Tech Team also followed the article's instructions and verified that they work.
This article has been viewed 52,631 times.
Learn more...
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 "python is not recognized as an internal or external command" that some users encounter after installing it.
Steps
Installing Python 3
-
1Go 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.
- If you want to use Python 2, see the "Installing Python 2" method.
-
2Click Download Python <version>. If this does not start the download immediately, click Save on the pop-up window to start it.
- 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]
Advertisement -
3Run the installer. You can do so by double-clicking python-<version>.exe in your Downloads folder.
-
4Check the box next to "Add Python <version> to PATH." It's at the bottom of the window.
- If you don't see this option, you'll need to complete this method after you finish installing Python.
-
5Click Customize installation. It's the second blue link on the window.
-
6Review the installation options and click Next. All 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.
-
7Check the box next to "Install for all users."" If you're a system administrator, this option ensures that other users on this computer can use Python. This also changes the installation location to the Program Files\(x86)\Python(version) instead of your personal library.
- If you didn't have the option to select "Add Python <version> to PATH" earlier, note the installation directory that appears here. You'll need to add it to your system variables after installing.
- If you don't want anyone else on the computer to use Python, you can leave the box unchecked.
-
8Click Install. It's at the bottom of the window.
-
9Click 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 yet.
-
10Click Disable path length limit. It's toward the bottom of the "Setup was successful" window. This final step ensures that Python (and other apps) can use paths more than 260 characters in length.
-
11Click Yes to confirm. Python is now installed and ready to use.
-
12Click Close to exit the installer.
-
13Test your Python installation. Here's how to ensure the path is set up properly:
- Type cmd into the Windows search bar and press ↵ Enter.
- 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.
- 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.
- Type exit() to return to the command prompt.
Installing Python 2
-
1Be aware that Python 2.x is no longer being maintained, and is not recommended to download or program with. And if you're new, you should download the newest version and learn the newest features of the Python language.
-
2Go 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.
-
3Scroll down and click a Python 2 version. The versions appear under the "Looking for a specific release?" header.
- 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.
-
4Scroll down and select an installer. This downloads the installer to your computer, though you may have to click Save to start the download.
- If you have a 64-bit computer, select Windows x86-64 MSI installer.
- If you're using a 32-bit computer, select Windows x86 MSI installer.
-
5Run the Python installer. You can do this by double-clicking python-(version).msi in your Downloads folder.
-
6Select an option for installing. If you want other users of this PC to use Python, select Install for all users. If not, select Install for just me.
-
7Click Next. It's at the bottom-right corner.
-
8Select 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.
-
9Click Next.
-
10Scroll 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.
- If you don't see this option, see this method after installing Python.
-
11Click the X button next to "Add python.exe to Path." A menu will expand.
-
12Click Will be installed on local hard drive. This ensures you can run Python commands from anywhere without having to type the full path to Python.
-
13Click Next. A security pop-up will appear on most systems at this point.
-
14Click 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."
-
15Click Finish on the installer. Python is now installed.
-
16Test your Python installation. Here's how to ensure the path is set up properly:
- Type cmd into the Windows search bar and press ↵ Enter.
- 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.
- 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.
- Type exit() to return to the command prompt.
Adding the Python Path to Windows
-
1Press ⊞ 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.
-
2Type sysdm.cpl and click OK. This opens the System Properties dialog.
-
3Click the Advanced tab. It's at the top of the window.
-
4Click Evironment Variables. It's near the bottom of the window.
-
5Select the Path variable under "System variables." This is in the second group of variables (not the "User variables" group on top).
-
6Click Edit. It's at the bottom of the window.
-
7Edit 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:
- Click inside the "Variable value" box to delete the selected text.
- Scroll all the way to the end of the text already in the "Variable value" box.
- Type a semicolon ; at the end of the text (no spaces).
- Type the full path to Python (e.g., C:\Python27) right after the semicolon.
- Type a semicolon ; at the end of what you just typed (no spaces).
- Type the full path again, but add \Scripts to the end. Example: C:\Python27\Scripts;C:\Python27\Scripts.
- Click OK until you've closed all windows, and then restart your PC. No need to continue with this method.
-
8Click New. It's the first button near the top-right corner of the window.
-
9Enter the full path to Python. For example, if Python is installed to C:\Python27, type that into the field.
-
10Press ↵ Enter. Now you'll have to enter just one more path.
-
11Click New again.
-
12Enter 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.
- For example, C:\Python27\Scripts.
-
13Press ↵ Enter. Your new variables are saved.
-
14Click OK and then OK again. You should now run Python from the command line by typing python.
Community Q&A
-
QuestionWhich programming language will I need to use to write a music downloading website?R2_d2000Top AnswererYou will need to use HTML, and you could also use other programming languages, like Java or JavaScript (JavaScript is not the same as Java).
References
About This Article
1. Go to https://www.python.org/downloads.
2. Download the latest version.
3. Open the installer.
4. Select Add Python to PATH.
5. Click Customize installation.
6. Click Next.
7. Select Install for all users.
8. Click Install.
9. Click Disable path length limit after installing.