python vs python3 vs py: Which Command to Use
Which command runs Python: python, python3 or py? What each does on Windows, macOS and Linux, how to choose a version, and why python may not exist.
On Windows run python, and use py when you need to choose between versions. On macOS and Linux run python3. Inside an activated virtual environment run python. Those commands are the ones the official documentation points to, and they avoid the “wrong Python” problems that the older advice caused.
At a glance
| Command | Windows (Python install manager) | macOS and Linux | Active virtual environment |
|---|---|---|---|
python |
Recommended; runs your default runtime | Optional: may be absent, or point to Python 2 or 3 | Always available |
python3 |
Included, but only to catch accidental POSIX habits | Expected to exist (PEP 394) | Available |
python3.14 and similar |
Only if you add the manager’s bin directory to PATH |
Available if that version is installed | Available for its version |
py |
Recommended for working with several versions | Not part of Unix installs | Not needed |
py -3.14 |
Launches Python 3.14 | Not available | Not needed |
Why there are several names
When Python 3 appeared, systems kept python pointing at Python 2 so old scripts kept working, and added python3 for the new version. PEP 394 describes how that became inconsistent: in 2011 most distributions aliased python to Python 2 while some started switching it to Python 3. Its current recommendation is that Unix-like systems install python3 for Python 3, that the python command is optional (a distributor may point it at Python 3, at Python 2, or not provide it), and that when a virtual environment is active python always refers to that environment’s interpreter. PEP 394 states that, for end users, python is still the preferred spelling for explicitly invoking Python because virtual environments make it consistently available across platforms.
On Windows
Windows does not include a system-supported Python. The documentation tells you to get Python from the CPython team with the Python install manager, from the Microsoft Store or python.org. After installing it, the python, py and pymanager commands are available. The documentation says:
pythonis the recommended command for launching Python. It runs the version requested by a script, an active virtual environment, or your default runtime, which is the latest stable release unless you configure otherwise.pyis the recommended command for scenarios with several versions. By default it behaves likepython, and it also selects versions and manages installs.- A
python3command is also included, but only to catch accidental use of the typical POSIX command on Windows. It is not meant to be widely used or recommended.
python --version # your default runtime, or the active virtual environment
py -3.14 --version # a specific installed version (py -V:3.14 is equivalent)
py list # installed runtimes, and which one is the default
py install 3.14 # install another runtimeThe versioned names such as python3.14.exe only work if you add the install manager’s directory (by default %LocalAppData%\Python\bin) to your PATH; the py command works without it. The older py -0 is kept for compatibility with the previous launcher, with py list as its replacement.
The traditional installer and the old py.exe launcher were deprecated in Python 3.14, and the full installer will not be produced for Python 3.16 or later. Tutorials that tell you to tick “Add Python to PATH” describe the old installer. If python opens the Microsoft Store instead, the documentation suggests opening “Manage app execution aliases” and checking that the aliases for “Python (default)” are enabled. For the full walkthrough, see how to install Python on Windows.
On macOS and Linux
Use python3, and the versioned command if you have several versions installed:
python3 --version
python3.14 -m venv .venvRecent versions of macOS include a python3 command at /usr/bin/python3. According to Python’s macOS documentation it links to a usually older and incomplete Python provided by and for Apple’s development tools, which you should never modify or delete. If you install Python from python.org, the default installer options ensure its python3 is used instead of the system one.
If you install packages into a system Python you may hit an externally-managed-environment error. A virtual environment avoids it.
Inside a virtual environment
Activating a virtual environment puts its own python and pip at the front of your PATH. A fresh environment created with python3 -m venv .venv contains these commands:
$ ls .venv/bin
Activate.ps1 activate activate.csh activate.fish pip pip3 pip3.13 python python3 python3.13
So python, python3 and the versioned name all refer to that environment’s interpreter, which is the point.
source .venv/bin/activate
python --versionManaging several versions
If you need more than one version, use a tool rather than juggling command names. uv installs and selects versions per project, and pyenv does similar; see pyenv vs uv.
uv python install 3.14
uv run --python 3.14 python --versionChecking which one you are running
python -c "import sys; print(sys.executable, sys.version)"This prints the exact interpreter path and version, which settles most “wrong Python” problems. If imports fail afterwards, see ModuleNotFoundError: No module named.
Frequently Asked Questions
What is the difference between python and python3?
On Unix-like systems, distributors are expected to provide python3 for Python 3 (PEP 394). Whether a python command exists at all, and whether it runs Python 2 or 3, depends on the distribution, and some Linux distributions provide only python3 by default. On Windows with the Python install manager, python is the recommended command.
What is the py command on Windows?
py comes with the Python install manager and is the recommended command whenever you work with several Python versions. py runs your default runtime, py -3.14 or py -V:3.14 launches a specific one, and py list shows what is installed. It replaces the older py.exe launcher, which has been deprecated since Python 3.14.
Why does python not work but python3 does?
On many Linux distributions the python command is optional and not installed by default, while python3 is expected to exist. Use python3, or create and activate a virtual environment, which always provides a python command.
How do I run a specific Python version?
On Windows use py -3.14 or py -V:3.14. On macOS and Linux use the versioned command such as python3.14 if that version is installed, or let uv choose with uv run —python 3.14 python.
Which command should I use inside a virtual environment?
python. PEP 394 says that when a virtual environment is active, the python command should refer to its interpreter and should always be available, with python3 available as well.