Installing Python 3 on Windows via the command line is straightforward—you’ll get a fully functional environment without navigating menus, installer dialogs, or adding Python to system PATH in GUI steps. This method works for all modern Windows versions (10 or 11) and ensures Python is ready to use immediately after installation, without extra configuration. You’ll need a static IP or stable network (if downloading large files remotely) and at least 200 MB of free space on your system drive.
What You'll Need
- Windows PC with internet access
- Administrator rights (to install Python in system directories)
- At least 200 MB free space on your C:\ drive
- A command-line interface (Command Prompt, PowerShell, or Git Bash)
Step-by-Step
-
Open an elevated Command Prompt or PowerShell window by pressing
Win + Xand selectingWindows Terminal (Admin), then chooseCommand PromptorPowerShellfrom the menu. If prompted by UAC, clickYesto grant admin privileges.Alternatively, run the following in PowerShell or Command Prompt:
Start-Process powershell -Verb RunAs. -
Download the latest Python 3 installer for Windows from the official website. Go to the Python Downloads page, scroll to the Windows installer (64-bit) section, and click the Download Python 3.x.x.x link. Wait for the file to download fully (it may take a few minutes).
Note: Do not use the installer PDF or software bundles—only the direct .exe file. The URL may change slightly, but always verify the source is
python.orgfor security. -
Locate the downloaded installer file (typically in your
Downloadsfolder) and run it by typing its full path in the Command Prompt/PowerShell window. For example, if the file is namedpython-3.11.4-amd64.exe, navigate to yourDownloadsfolder first (typecd C:\Users\YourUsername\Downloads) and then run:python-3.11.4-amd64.exeIf you’re unsure of the filename, use Windows Search: Open
File Explorer, navigate toDownloads, and right-click the .exe file to copy its path, then paste it into the Command Prompt. -
During installation, you will see a prompt asking whether you want to add Python to your PATH. Choose
No—this is the command-line method, so PATH integration is not required for basic usage. Skip this step to avoid conflicts with your system’s PATH configuration.Next, click
Install Nowand let the installer complete. You should see progress bars filling up as Python sets up directories (e.g.,Python.exeinC:\PythonXX\). -
Once installation finishes, close the installer window. You’ll have a new folder named
PythonXX(e.g.,Python311) in your system drive’s root (e.g.,C:\Python311). Verify this by running:dir C:\PythonXXYou should see files like
Python.exe,pip.exe, andpython.exe. If you get aAccess Deniederror, ensure you ran Command Prompt/PowerShell as Administrator. -
Test Python by running:
cd C:\PythonXXpython.exeIf successful, you’ll see the Python interactive shell (prompt:
>>>>). Typeexit()to leave. This confirms Python is installed and accessible directly. -
To verify pip (Python’s package manager) works, run:
pip.exe --versionYou should see output like
pip 23.0.1 from .../site-packages/pip.zip. If pip fails, try upgrading it first with:pip.exe install --upgrade pip -
To ensure Python is in your system’s PATH for future use (optional), add it manually. Open Command Prompt again as Administrator, then run:
setx /M PATH "%PATH%;C:\PythonXX"Note: Replace
PythonXXwith your actual folder name (e.g.,Python311). This change requires a reboot to take effect.
Common Mistakes
-
Skipping the
Nooption when prompted to add Python to PATH. This step is for GUI installs—command-line installs work without it. If you accidentally checkYes, skip the PATH setup and restart the Command Prompt. -
Using the wrong installer (e.g., 32-bit instead of 64-bit or a bundle with extra software). Always download the Windows installer (64-bit) from
python.org. For 32-bit systems, use thepython.exeversion. -
Running Command Prompt as a non-admin user. Python installs system files (e.g.,
C:\PythonXX\), so you need admin rights. Ifpython.exefails, right-click the Command Prompt icon, chooseRun as administrator. -
Installing Python in a non-system directory (e.g.,
C:\Program Files\PythonXX). This method installs directly toC:\PythonXX. If you use a folder outside system drives, you must manually edit system environment variables to include its path. -
Overwriting an existing Python installation. Check for conflicts by running
where python.exein Command Prompt (orwhere pythonin PowerShell). If Python is already installed, delete its folder before reinstalling. -
Not verifying pip works. If
pip.exe --versionfails, upgrade pip first withpip.exe install --upgrade pip. If that fails, try installing it manually frompython.orgor use the full path:.\PythonXX\Scripts\pip.exe --version.
Tips
-
Use PowerShell for better error handling. Run the installer as
Start-Process python.exe -Wait -NoNewWindowto wait for completion and avoid manual checks. Example path:Start-Process python-3.11.4-amd64.exe -Wait -NoNewWindow. -
For large downloads, download first via a browser or file manager, then run the installer from the Command Prompt. This avoids buffering issues during installation.
-
If you encounter disk space errors, move the installer to a different location (e.g.,
D:\Downloads\) before running it. Python installs toC:\PythonXXby default. -
Create a shortcut to Python’s executable in the system tray for quick access. Right-click the desktop, choose
New > Shortcut, enterC:\PythonXX\python.exe(replaceXXwith your version), and name itPython. Right-click the shortcut >Properties, then clickShortcut>Browseand select the.exefile to avoid path issues. -
Use
python -m pip install packageto install packages directly from the command line without opening Python’s shell. Example:python -m pip install numpy. -
Avoid mixing Python versions. If you later need a different version, uninstall the current one first (delete
C:\PythonXX) and reinstall the new version. Do not install multiple versions side-by-side without proper configuration.
Troubleshooting
-
Python is not recognized when you type
pythonorpython.exein Command Prompt.Check if Python is installed by running:
dir C:\PythonXXIf the folder exists but Python isn’t recognized, ensure Python is added to PATH. Go to
System Properties > Environment Variables, findPATHunderSystem variables, clickEdit, and addC:\PythonXX(replaceXXwith your folder name). Restart Command Prompt.If you chose
Noduring installation, skip this step and restart the Command Prompt (it may inherit PATH from the previous session). -
Installer fails with "Access Denied" or "Permission denied."
Run Command Prompt as Administrator (right-click >
Run as administrator). If the issue persists, move the installer to a different location (e.g.,D:\Downloads\) to avoid filesystem restrictions. -
pip fails to install packages or shows version errors.
First, upgrade pip with:
python.exe -m pip install --upgrade pipIf that fails, try installing pip manually from
python.org/downloads/windows/or use the full path:.\PythonXX\Scripts\pip.exe install --upgrade pipIf you still see errors, verify your Python installation by running:
python.exe --versionand ensure it matches the version you installed.
-
The installer hangs or crashes during installation.
Download the installer first via a browser or file manager, then run it from Command Prompt. Avoid running multiple installer windows simultaneously. If the installer freezes, close all tasks and try again.
-
Python is installed but commands still don’t work in your current terminal session.
Close and reopen Command Prompt/PowerShell. The PATH may not update automatically in an open session. Alternatively, restart your PC to ensure all environment variables are reset.
-
You get a
ModuleNotFoundErrorafter installing packages.This usually means Python isn’t in your PATH. Add Python’s directory (e.g.,
C:\PythonXX) to PATH manually viaSystem Properties > Environment Variables, or reinstall Python with PATH integration (skip theNooption during installation).
Frequently Asked Questions
How do I know which Python version to download?
Always use the latest 64-bit version from python.org. Check the Windows installer (64-bit) section. For 32-bit systems, use the python.exe version.
Why does my Command Prompt say Python is not recognized after installation?
This happens if Python wasn’t added to PATH during installation (you chose No) or if the PATH wasn’t updated. Restart Command Prompt or manually add C:\PythonXX to PATH via Environment Variables.
Can I install Python in a folder other than C:\PythonXX and still use it?
Yes, but you must manually edit PATH to include the new folder. For example, if you install to D:\Python311, add D:\Python311 to PATH. This requires admin rights.
How do I uninstall Python installed via this method?
Delete the folder C:\PythonXX (replace XX with your version). If you added Python to PATH manually, remove it from Environment Variables as well.
What should I do if the installer doesn’t have a .exe file?
Ignore the installer PDF or bundled software. The only valid download is the direct .exe file from python.org. If the page changes, search for python.org windows installer and verify the source.
How do I verify Python is working after installation?
Run python.exe --version in Command Prompt. If it shows the correct version (e.g., Python 3.11.4), Python is installed. To test scripts, run python.exe script.py (replace script.py with your filename).