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

  1. Open an elevated Command Prompt or PowerShell window by pressing Win + X and selecting Windows Terminal (Admin), then choose Command Prompt or PowerShell from the menu. If prompted by UAC, click Yes to grant admin privileges.

    Alternatively, run the following in PowerShell or Command Prompt: Start-Process powershell -Verb RunAs.

  2. 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.org for security.

  3. Locate the downloaded installer file (typically in your Downloads folder) and run it by typing its full path in the Command Prompt/PowerShell window. For example, if the file is named python-3.11.4-amd64.exe, navigate to your Downloads folder first (type cd C:\Users\YourUsername\Downloads) and then run:

    python-3.11.4-amd64.exe

    If you’re unsure of the filename, use Windows Search: Open File Explorer, navigate to Downloads, and right-click the .exe file to copy its path, then paste it into the Command Prompt.

  4. 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 Now and let the installer complete. You should see progress bars filling up as Python sets up directories (e.g., Python.exe in C:\PythonXX\).

  5. 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:\PythonXX

    You should see files like Python.exe, pip.exe, and python.exe. If you get a Access Denied error, ensure you ran Command Prompt/PowerShell as Administrator.

  6. Test Python by running:

    cd C:\PythonXX python.exe

    If successful, you’ll see the Python interactive shell (prompt: >>>>). Type exit() to leave. This confirms Python is installed and accessible directly.

  7. To verify pip (Python’s package manager) works, run:

    pip.exe --version

    You 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
  8. 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 PythonXX with your actual folder name (e.g., Python311). This change requires a reboot to take effect.

Common Mistakes

  • Skipping the No option when prompted to add Python to PATH. This step is for GUI installs—command-line installs work without it. If you accidentally check Yes, 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 the python.exe version.

  • Running Command Prompt as a non-admin user. Python installs system files (e.g., C:\PythonXX\), so you need admin rights. If python.exe fails, right-click the Command Prompt icon, choose Run as administrator.

  • Installing Python in a non-system directory (e.g., C:\Program Files\PythonXX). This method installs directly to C:\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.exe in Command Prompt (or where python in PowerShell). If Python is already installed, delete its folder before reinstalling.

  • Not verifying pip works. If pip.exe --version fails, upgrade pip first with pip.exe install --upgrade pip. If that fails, try installing it manually from python.org or 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 -NoNewWindow to 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 to C:\PythonXX by default.

  • Create a shortcut to Python’s executable in the system tray for quick access. Right-click the desktop, choose New > Shortcut, enter C:\PythonXX\python.exe (replace XX with your version), and name it Python. Right-click the shortcut > Properties, then click Shortcut > Browse and select the .exe file to avoid path issues.

  • Use python -m pip install package to 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

  1. Python is not recognized when you type python or python.exe in Command Prompt.

    Check if Python is installed by running:

    dir C:\PythonXX

    If the folder exists but Python isn’t recognized, ensure Python is added to PATH. Go to System Properties > Environment Variables, find PATH under System variables, click Edit, and add C:\PythonXX (replace XX with your folder name). Restart Command Prompt.

    If you chose No during installation, skip this step and restart the Command Prompt (it may inherit PATH from the previous session).

  2. 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.

  3. pip fails to install packages or shows version errors.

    First, upgrade pip with:

    python.exe -m pip install --upgrade pip

    If that fails, try installing pip manually from python.org/downloads/windows/ or use the full path:

    .\PythonXX\Scripts\pip.exe install --upgrade pip

    If you still see errors, verify your Python installation by running:

    python.exe --version

    and ensure it matches the version you installed.

  4. 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.

  5. 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.

  6. You get a ModuleNotFoundError after installing packages.

    This usually means Python isn’t in your PATH. Add Python’s directory (e.g., C:\PythonXX) to PATH manually via System Properties > Environment Variables, or reinstall Python with PATH integration (skip the No option 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).