Python Launcher for Windows (py.exe)
py.exe is the Windows Python launcher that coordinates execution of Python scripts by selecting the appropriate interpreter version based on shebang lines and version specifiers. It enables seamless use of multiple Python installations from a single binary, improves script portability, and is installed with Python distributions on Windows to streamline command-line usage.
py.exe resolves Python versions at runtime by inspecting shebangs or -X version directives and mapping to installed interpreters under Windows Program Files or AppData paths, enabling consistent script execution across environments.
py.exe, when installed from official Python distributions for Windows (python.org or the Microsoft Store), is a legitimate launcher signed by the Python Software Foundation. It does not execute arbitrary code by itself; instead it launches the selected Python interpreter to run a script. Properly signed binaries and standard installation paths reduce risk, and users should verify the installer source, compare checksums, and keep Python up to date to maintain security.
As shipped by official Python sources, py.exe is not a virus. However, attackers can replace or imitate launchers in deceptive environments. Always verify the file location, digital signature, and hash, and run malware scans if you encounter py.exe in unusual directories or with unexpected behavior. When in doubt, reinstall Python from the official site and reset PATH entries.
Red Flags: Unexpected location (non-system paths), missing or invalid digital signatures, a mismatched file size, or sudden, unexplained CPU spikes when launching Python scripts are strong indicators to investigate further.
Reasons it's running:
py.exe is the Windows Python launcher designed to select the right Python interpreter version when running a script. It helps manage multiple Python installations and ensures scripts run with the intended interpreter.
Yes, py.exe is part of official Python distributions and is digitally signed by the Python Software Foundation. Used from trusted sources, it should be safe; verify signatures if you see it in unexpected locations.
Check its location (C:\Windows\py.exe or a trusted Python install), verify the digital signature, compare SHA256 hashes with the official release, and scan with a reputable antivirus.
Actual CPU usage typically relates to the Python script itself. If py.exe spikes, examine the script, library calls, and possible background tasks; ensure the launcher isn’t triggering excessive interpreter restarts.
Invoke the desired interpreter directly (e.g., C:\Python39\python.exe script.py) or use py -3, py -3.8, etc., to pick the matching interpreter before running the script.
Only if you will consistently call python.exe directly and understand that some tooling may rely on py.exe for version resolution; otherwise keeping it installed simplifies multi-version workflows.
Standard Python 3.x interpreter that py.exe can launch when selecting a version.
The common Python interpreter binary used for running scripts directly.
Launcher variant that runs Python scripts without a command console.
System shell used to run py.exe commands and Python scripts from the command line.